github typicode/lowdb v0.17.0

latest releases: v7.0.1, v7.0.0, v6.1.1...
6 years ago

Breaking changes

low() function has been updated to be more explicit and fully storage agnostic. It now expects an adapter to be passed.

Also, when using async file storage, low() will now return a Promise, making it truely asyncrhonous, rather than the database instance.

tl;dr

See Examples page for updated code samples.

Migration guide

// 0.16
const db = low('db.json')

// 0.17
const low = require('lowdb')
const FileSync = require('lowdb/adapters/FileSync')

const adapter = new FileSync('db.json')
const db = low(adapter)

The rest of lowdb API is unchanged, database instance creation is the only part of your code that needs to be updated.

Adapters

Lowdb comes bundled with 4 adapters:

  • lowdb/adapters/FileSync
  • lowdb/adapters/FileAsync
  • lowdb/adapters/LocalStorage
  • lowdb/adapters/Memory

Special thanks to @yeskunall for the help!

Don't miss a new lowdb release

NewReleases is sending notifications on new releases.