Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

levelup

Level2.7mMITdeprecated5.1.1TypeScript support: definitely-typed

Superseded by abstract-level (https://github.com/Level/community#faq)

Fast & simple storage - a Node.js-style LevelDB wrapper

level, leveldb, stream, database, db, store, storage, json

readme

levelup

level badge npm Node version Test Coverage Standard Common Changelog Donate

Table of Contents

<summary>Click to expand</summary>

Introduction

Fast and simple storage. A Node.js wrapper for abstract-leveldown compliant stores, which follow the characteristics of LevelDB.

LevelDB is a simple key-value store built by Google. It's used in Google Chrome and many other products. LevelDB supports arbitrary byte arrays as both keys and values, singular get, put and delete operations, batched put and delete, bi-directional iterators and simple compression using the very fast Snappy algorithm.

LevelDB stores entries sorted lexicographically by keys. This makes the streaming interface of levelup - which exposes LevelDB iterators as Readable Streams - a very powerful query mechanism.

The most common store is leveldown which provides a pure C++ binding to LevelDB. Many alternative stores are available such as level.js in the browser or memdown for an in-memory store. They typically support strings and Buffers for both keys and values. For a richer set of data types you can wrap the store with encoding-down.

The level package is the recommended way to get started. It conveniently bundles levelup, leveldown and encoding-down. Its main export is levelup - i.e. you can do var db = require('level').

Supported Platforms

We aim to support Active LTS and Current Node.js releases as well as browsers. For support of the underlying store, please see the respective documentation.

Sauce Test Status

Usage

If you are upgrading: please see UPGRADING.md.

First you need to install levelup! No stores are included so you must also install leveldown (for example).

$ npm install levelup leveldown

All operations are asynchronous. If you do not provide a callback, a Promise is returned.

var levelup = require('levelup')
var leveldown = require('leveldown')

// 1) Create our store
var db = levelup(leveldown('./mydb'))

// 2) Put a key & value
db.put('name', 'levelup', function (err) {
  if (err) return console.log('Ooops!', err) // some kind of I/O error

  // 3) Fetch by key
  db.get('name', function (err, value) {
    if (err) return console.log('Ooops!', err) // likely the key was not found

    // Ta da!
    console.log('name=' + value)
  })
})

API

levelup(db[, options[, callback]])

The main entry point for creating a new levelup instance.

  • db must be an abstract-leveldown compliant store.
  • options is passed on to the underlying store when opened and is specific to the type of store being used

Calling levelup(db) will also open the underlying store. This is an asynchronous operation which will trigger your callback if you provide one. The callback should take the form function (err, db) {} where db is the levelup instance. If you don't provide a callback, any read & write operations are simply queued internally until the store is fully opened, unless it fails to open, in which case an error event will be emitted.

This leads to two alternative ways of managing a levelup instance:

levelup(leveldown(location), options, function (err, db) {
  if (err) throw err

  db.get('foo', function (err, value) {
    if (err) return console.log('foo does not exist')
    console.log('got foo =', value)
  })
})

Versus the equivalent:

// Will throw if an error occurs
var db = levelup(leveldown(location), options)

db.get('foo', function (err, value) {
  if (err) return console.log('foo does not exist')
  console.log('got foo =', value)
})

db.supports

A read-only manifest. Might be used like so:

if (!db.supports.permanence) {
  throw new Error('Persistent storage is required')
}

if (db.supports.bufferKeys && db.supports.promises) {
  await db.put(Buffer.from('key'), 'value')
}

db.open([options][, callback])

Opens the underlying store. In general you shouldn't need to call this method directly as it's automatically called by levelup(). However, it is possible to reopen the store after it has been closed with close().

If no callback is passed, a promise is returned.

db.close([callback])

close() closes the underlying store. The callback will receive any error encountered during closing as the first argument.

You should always clean up your levelup instance by calling close() when you no longer need it to free up resources. A store cannot be opened by multiple instances of levelup simultaneously.

If no callback is passed, a promise is returned.

db.put(key, value[, options][, callback])

put() is the primary method for inserting data into the store. Both key and value can be of any type as far as levelup is concerned.

options is passed on to the underlying store.

If no callback is passed, a promise is returned.

db.get(key[, options][, callback])

Get a value from the store by key. The key can be of any type. If it doesn't exist in the store then the callback or promise will receive an error. A not-found err object will be of type 'NotFoundError' so you can err.type == 'NotFoundError' or you can perform a truthy test on the property err.notFound.

db.get('foo', function (err, value) {
  if (err) {
    if (err.notFound) {
      // handle a 'NotFoundError' here
      return
    }
    // I/O or other error, pass it up the callback chain
    return callback(err)
  }

  // .. handle `value` here
})

The optional options object is passed on to the underlying store.

If no callback is passed, a promise is returned.

db.getMany(keys[, options][, callback])

Get multiple values from the store by an array of keys. The optional options object is passed on to the underlying store.

The callback function will be called with an Error if the operation failed for any reason. If successful the first argument will be null and the second argument will be an array of values with the same order as keys. If a key was not found, the relevant value will be undefined.

If no callback is provided, a promise is returned.

db.del(key[, options][, callback])

del() is the primary method for removing data from the store.

db.del('foo', function (err) {
  if (err)
    // handle I/O or other error
});

options is passed on to the underlying store.

If no callback is passed, a promise is returned.

db.batch(array[, options][, callback]) (array form)

batch() can be used for very fast bulk-write operations (both put and delete). The array argument should contain a list of operations to be executed sequentially, although as a whole they are performed as an atomic operation inside the underlying store.

Each operation is contained in an object having the following properties: type, key, value, where the type is either 'put' or 'del'. In the case of 'del' the value property is ignored. Any entries with a key of null or undefined will cause an error to be returned on the callback and any type: 'put' entry with a value of null or undefined will return an error.

const ops = [
  { type: 'del', key: 'father' },
  { type: 'put', key: 'name', value: 'Yuri Irsenovich Kim' },
  { type: 'put', key: 'dob', value: '16 February 1941' },
  { type: 'put', key: 'spouse', value: 'Kim Young-sook' },
  { type: 'put', key: 'occupation', value: 'Clown' }
]

db.batch(ops, function (err) {
  if (err) return console.log('Ooops!', err)
  console.log('Great success dear leader!')
})

options is passed on to the underlying store.

If no callback is passed, a promise is returned.

db.batch() (chained form)

batch(), when called with no arguments will return a Batch object which can be used to build, and eventually commit, an atomic batch operation. Depending on how it's used, it is possible to obtain greater performance when using the chained form of batch() over the array form.

db.batch()
  .del('father')
  .put('name', 'Yuri Irsenovich Kim')
  .put('dob', '16 February 1941')
  .put('spouse', 'Kim Young-sook')
  .put('occupation', 'Clown')
  .write(function () { console.log('Done!') })

batch.put(key, value[, options])

Queue a put operation on the current batch, not committed until a write() is called on the batch. The options argument, if provided, must be an object and is passed on to the underlying store.

This method may throw a WriteError if there is a problem with your put (such as the value being null or undefined).

batch.del(key[, options])

Queue a del operation on the current batch, not committed until a write() is called on the batch. The options argument, if provided, must be an object and is passed on to the underlying store.

This method may throw a WriteError if there is a problem with your delete.

batch.clear()

Clear all queued operations on the current batch, any previous operations will be discarded.

batch.length

The number of queued operations on the current batch.

batch.write([options][, callback])

Commit the queued operations for this batch. All operations not cleared will be written to the underlying store atomically, that is, they will either all succeed or fail with no partial commits.

The optional options object is passed to the .write() operation of the underlying batch object.

If no callback is passed, a promise is returned.

db.status

A readonly string that is one of:

  • new - newly created, not opened or closed
  • opening - waiting for the underlying store to be opened
  • open - successfully opened the store, available for use
  • closing - waiting for the store to be closed
  • closed - store has been successfully closed.

db.isOperational()

Returns true if the store accepts operations, which in the case of levelup means that status is either opening or open, because it opens itself and queues up operations until opened.

db.createReadStream([options])

Returns a Readable Stream of key-value pairs. A pair is an object with key and value properties. By default it will stream all entries in the underlying store from start to end. Use the options described below to control the range, direction and results.

db.createReadStream()
  .on('data', function (data) {
    console.log(data.key, '=', data.value)
  })
  .on('error', function (err) {
    console.log('Oh my!', err)
  })
  .on('close', function () {
    console.log('Stream closed')
  })
  .on('end', function () {
    console.log('Stream ended')
  })

You can supply an options object as the first parameter to createReadStream() with the following properties:

  • gt (greater than), gte (greater than or equal) define the lower bound of the range to be streamed. Only entries where the key is greater than (or equal to) this option will be included in the range. When reverse=true the order will be reversed, but the entries streamed will be the same.

  • lt (less than), lte (less than or equal) define the higher bound of the range to be streamed. Only entries where the key is less than (or equal to) this option will be included in the range. When reverse=true the order will be reversed, but the entries streamed will be the same.

  • reverse (boolean, default: false): stream entries in reverse order. Beware that due to the way that stores like LevelDB work, a reverse seek can be slower than a forward seek.

  • limit (number, default: -1): limit the number of entries collected by this stream. This number represents a maximum number of entries and may not be reached if you get to the end of the range first. A value of -1 means there is no limit. When reverse=true the entries with the highest keys will be returned instead of the lowest keys.

  • keys (boolean, default: true): whether the results should contain keys. If set to true and values set to false then results will simply be keys, rather than objects with a key property. Used internally by the createKeyStream() method.

  • values (boolean, default: true): whether the results should contain values. If set to true and keys set to false then results will simply be values, rather than objects with a value property. Used internally by the createValueStream() method.

db.createKeyStream([options])

Returns a Readable Stream of keys rather than key-value pairs. Use the same options as described for createReadStream() to control the range and direction.

You can also obtain this stream by passing an options object to createReadStream() with keys set to true and values set to false. The result is equivalent; both streams operate in object mode.

db.createKeyStream()
  .on('data', function (data) {
    console.log('key=', data)
  })

// same as:
db.createReadStream({ keys: true, values: false })
  .on('data', function (data) {
    console.log('key=', data)
  })

db.createValueStream([options])

Returns a Readable Stream of values rather than key-value pairs. Use the same options as described for createReadStream() to control the range and direction.

You can also obtain this stream by passing an options object to createReadStream() with values set to true and keys set to false. The result is equivalent; both streams operate in object mode.

db.createValueStream()
  .on('data', function (data) {
    console.log('value=', data)
  })

// same as:
db.createReadStream({ keys: false, values: true })
  .on('data', function (data) {
    console.log('value=', data)
  })

db.iterator([options])

Returns an abstract-leveldown iterator, which is what powers the readable streams above. Options are the same as the range options of createReadStream() and are passed to the underlying store.

These iterators support for await...of:

for await (const [key, value] of db.iterator()) {
  console.log(value)
}

db.clear([options][, callback])

Delete all entries or a range. Not guaranteed to be atomic. Accepts the following range options (with the same rules as on iterators):

  • gt (greater than), gte (greater than or equal) define the lower bound of the range to be deleted. Only entries where the key is greater than (or equal to) this option will be included in the range. When reverse=true the order will be reversed, but the entries deleted will be the same.
  • lt (less than), lte (less than or equal) define the higher bound of the range to be deleted. Only entries where the key is less than (or equal to) this option will be included in the range. When reverse=true the order will be reversed, but the entries deleted will be the same.
  • reverse (boolean, default: false): delete entries in reverse order. Only effective in combination with limit, to remove the last N records.
  • limit (number, default: -1): limit the number of entries to be deleted. This number represents a maximum number of entries and may not be reached if you get to the end of the range first. A value of -1 means there is no limit. When reverse=true the entries with the highest keys will be deleted instead of the lowest keys.

If no options are provided, all entries will be deleted. The callback function will be called with no arguments if the operation was successful or with an WriteError if it failed for any reason.

If no callback is passed, a promise is returned.

What happened to db.createWriteStream?

db.createWriteStream() has been removed in order to provide a smaller and more maintainable core. It primarily existed to create symmetry with db.createReadStream() but through much discussion, removing it was the best course of action.

The main driver for this was performance. While db.createReadStream() performs well under most use cases, db.createWriteStream() was highly dependent on the application keys and values. Thus we can't provide a standard implementation and encourage more write-stream implementations to be created to solve the broad spectrum of use cases.

Check out the implementations that the community has produced here.

Promise Support

Each function accepting a callback returns a promise if the callback is omitted. The only exception is the levelup constructor itself, which if no callback is passed will lazily open the underlying store in the background.

Example:

const db = levelup(leveldown('./my-db'))
await db.put('foo', 'bar')
console.log(await db.get('foo'))

Events

levelup is an EventEmitter and emits the following events.

Event Description Arguments
put Key has been updated key, value (any)
del Key has been deleted key (any)
batch Batch has executed operations (array)
clear Entries were deleted options (object)
opening Underlying store is opening -
open Store has opened -
ready Alias of open -
closing Store is closing -
closed Store has closed. -
error An error occurred error (Error)

For example you can do:

db.on('put', function (key, value) {
  console.log('inserted', { key, value })
})

Multi-process Access

Stores like LevelDB are thread-safe but they are not suitable for accessing with multiple processes. You should only ever have a store open from a single Node.js process. Node.js clusters are made up of multiple processes so a levelup instance cannot be shared between them either.

See Level/awesome for modules like multileveldown that may help if you require a single store to be shared across processes.

Contributing

Level/levelup is an OPEN Open Source Project. This means that:

Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.

See the Contribution Guide for more details.

Big Thanks

Cross-browser Testing Platform and Open Source ♥ Provided by Sauce Labs.

Sauce Labs logo

Support us with a monthly donation on Open Collective and help us continue our work.

License

MIT

changelog

Changelog

5.1.1 - 2021-10-02

Added

  • Document new features (#727) (e1ecad9) (Vincent Weevers)

Fixed

  • Expose nextTick for API parity with abstract-leveldown (7bc86e4) (Vincent Weevers)
  • Set supports.status to true (e2e2c34) (Vincent Weevers)

5.1.0 - 2021-10-01

Changed

  • Bump deferred-leveldown from 6.x to 7.x (2226bba) (Vincent Weevers)

Added

  • Add db.getMany(keys) (02cf2d3) (Vincent Weevers).

5.0.1 - 2021-06-07

Changed

  • Remove use of assert module (#721) (f3e86ae) (Alex Potsides)

5.0.0 - 2021-04-17

If you are upgrading: please see UPGRADING.md.

Changed

  • Breaking: modernize syntax and bump standard (Level/community#98) (e19cd54, 762d989) (Vincent Weevers)
  • Breaking: remove Batch._levelup property (cfce6bb) (Vincent Weevers).
  • Align nextTick behavior with abstract-leveldown (4b35716) (Vincent Weevers).
  • Add files to package.json and remove .npmignore (29d8b5d) (Vincent Weevers)
  • Replace xtend with Object.assign() (7bfc0d4) (Vincent Weevers)
  • Bump deferred-leveldown, level-errors, -iterator-stream and -supports (8b518b1, 1b0cfb8) (Vincent Weevers)
  • Refactor promisify() code by using catering module (#700) (Lars-Magnus Skog)

Added

  • Support encoding options on chained batch put() and del() (#717, #633) (0765808) (Vincent Weevers)

Removed

4.4.0 - 2020-04-11

Changed

  • Increase abstract-leveldown parity (#692) (@vweevers):
    • Add db property to chained batch
    • Remove type checks that are also performed by abstract-leveldown
  • Upgrade dependency-check devDependency from ^3.3.0 to ^4.1.0 (71a6aa3) (@vweevers)
  • Upgrade airtap devDependency from ^2.0.0 to ^3.0.0 (#687) (@vweevers)

4.3.2 - 2019-10-04

Changed

  • Upgrade deferred-leveldown from ~5.2.1 to ~5.3.0 (#682) (@vweevers). This fixes the manifest added in 4.3.0.

Added

  • Test manifest integration with deferred-leveldown (#681) (@vweevers)

4.3.1 - 2019-10-03

Fixed

4.3.0 - 2019-09-30

Changed

Added

4.2.0 - 2019-09-08

Changed

Added

  • Add clear() method to delete all entries or a range (#669) (@vweevers)

4.1.0 - 2019-06-28

Many thanks to @MeirionHughes for adding seek() support to memdown, encoding-down, deferred-leveldown and subleveldown. At the time of writing, all but subleveldown have been released. Go forth and seek!

Changed

  • Upgrade deferred-leveldown from ~5.0.0 to ~5.1.0 (#657) (@vweevers)
  • Upgrade delayed devDependency from ^1.0.1 to ^2.0.0 (#659) (@vweevers)

Added

4.0.2 - 2019-06-08

Changed

Added

Removed

Fixed

4.0.1 - 2019-03-30

Changed

4.0.0 - 2018-12-22

If you are upgrading: please see UPGRADING.md.

Changed

  • Upgrade nyc devDependency from ~12.0.2 to ~13.1.0 (@ralphtheninja)
  • Upgrade deferred-leveldown dependency from ~4.0.0 to ~5.0.0 (@vweevers)
  • Upgrade concat-stream devDependency from ~1.6.0 to ~2.0.0 (@ralphtheninja)
  • Upgrade level-iterator-stream dependency from ~3.0.0 to ~4.0.0 (@ralphtheninja)
  • Replace remark-cli with hallmark (#621) (@vweevers)
  • Upgrade standard devDependency from ^11.0.0 to ^12.0.0 (@ralphtheninja)
  • Add .nyc_output/ to .npmignore (@ralphtheninja)

Removed

3.1.1 - 2018-07-14

Changed

Added

Removed

Fixed

3.1.0 - 2018-06-22

Changed

Added

Removed

Fixed

3.0.1 - 2018-05-24

Changed

Removed

3.0.0 - 2018-05-23

If you are upgrading: please see UPGRADING.md.

Added

Changed

Fixed

  • Fix defunct keyEncoding in inject-encoding-test.js (@vweevers)

Removed

2.0.2 - 2018-02-12

Added

Changed

Removed

2.0.1 - 2017-11-11

Changed

Fixed

2.0.0 - 2017-10-10

If you are upgrading: please see UPGRADING.md.

Added

  • Add default export (@zixia)
  • Test that key and value of queued operation is not serialized (@vweevers)
  • Test JSON encoding with stream (@vweevers)
  • Add smoke test for levelup and leveldown without encoding-down (@vweevers)

Changed

Removed

2.0.0-rc3 - 2017-09-15

Changed

Fixed

2.0.0-rc2 - 2017-09-11

Added

Changed

Removed

2.0.0-rc1 - 2017-09-01

Added

Changed

Removed

Fixed

1.3.9 - 2017-07-26

Added

Changed

1.3.8 - 2017-05-29

Changed

1.3.7 - 2017-05-24

Fixed

  • Avoid calling getLevelDOWN if not present (@diasdavid)

1.3.6 - 2017-05-10

Changed

  • Pull LevelDOWN loader out to non browserified module (@kemitchell)

1.3.5 - 2017-03-02

Changed

1.3.4 - 2017-03-02

Added

Removed

1.3.3 - 2016-10-09

Changed

1.3.2 - 2016-05-17

Added

Changed

Removed

Fixed

1.3.1 - 2015-12-10

Added

Changed

1.3.0 - 2015-11-12

Changed

Fixed

1.2.1 - 2015-06-10

Changed

  • Improve error message when trying to require leveldown (@ralphtheninja)

1.2.0 - 2015-06-04

Changed

Fixed

1.1.1 - 2015-05-29

Added

Changed

Removed

1.1.0 - 2015-05-17

Changed

1.0.0 - 2015-05-14

Removed

  • Remove return values from dispatchError() and readError(), they are used as voids (@ralphtheninja)

1.0.0-5 - 2015-05-07

Changed

  • Target multiple iojs versions, remove notifications (@ralphtheninja)
  • Deprecate static functions destroy() and repair() (@juliangruber)

1.0.0-4 - 2015-05-06

Changed

1.0.0-3 - 2015-05-05

Changed

1.0.0-2 - 2015-04-30

Changed

Fixed

1.0.0-1 - 2015-04-28

Added

  • Add test for valueEncoding 'hex' for createReadStream (@braydonf)

Changed

Fixed

  • Fix valueEncoding bug by passing options without array (@braydonf)

1.0.0-0 - 2015-04-28

Added

Changed

  • Support values to be null or undefined (@kesla)
  • README: explain callback arguments to del (@bewest)
  • README: update logo and copyright (@ralphtheninja)
  • README: remove docs on createWriteStream() and add note on what happened to it (@jcrugzz)
  • README: tweak explanation on why createWriteStream() was removed (@ralphtheninja)
  • README: clean up old level-ws reference (@ralphtheninja)
  • README: changed options for get to same as put (@RichardLitt)
  • README: remove reference to write-stream and iterators (@ralphtheninja)
  • Explicit devdep versions (@rvagg)
  • Update Travis and package.json scripts (@jcrugzz)
  • Added errors to the available namespace when requiring levelup (@braydonf)
  • Extract error codes into level-errors module (@ralphtheninja)
  • Use level-codec (@juliangruber)
  • Refactor iterators using new deferred-leveldown (@juliangruber)

Removed

Fixed

0.19.1 - 2016-01-23

Added

Changed

Removed

0.19.0 - 2014-08-26

Added

Changed

  • Refactor encodings and codec from util to separate file (@dominictarr)
  • Decouple codec from levelup parts for allowing arbitrary encoding strategies (@dominictarr)
  • Decouple read-stream from encoding and opening stuff (@dominictarr)
  • Keep codec on the db as db._codec (@dominictarr)
  • Refactor error checks (@dominictarr)
  • README: document lt, lte, gt, and gte (@dominictarr)
  • README: clarify ltgt (@dominictarr)
  • README: unmention bops (@dominictarr)
  • README: discourage the use of start and end a bit (@raboof)
  • README: document what limit does in reverse mode (@raboof)
  • README: use highest/lowest instead of largest/smallest (@raboof)
  • Binary encoding in the browser (@calvinmetcalf)
  • Document code with comments (@dominictarr)
  • Minor style fixes (@rvagg)
  • Minor whitespace changes (@rvagg)
  • Update nodeico badge (@rvagg)

Fixed

0.18.6 - 2014-07-26

Changed

  • Change from MIT +no-false-attribs License to plain MIT (@andrewrk)
  • Upgrade bl dependency (@raynos)

0.18.5 - 2014-06-26

Fixed

  • Replace concat-stream with bl, fixes #251 (@rvagg)

0.18.4 - 2014-06-24

Changed

Fixed

  • Fix race condition on read stream's self._iterator (@nolanlawson)

0.18.3 - 2014-04-26

Changed

  • README: fix formatting (@rvagg)
  • README: minor corrections (@guybrush)
  • README: fix leveldown method wording (@juliangruber)
  • README: clarify start, end and limit options in createReadStream docs (@maxogden)

Removed

0.18.2 - 2013-11-26

Added

  • Add DNT configuration (@rvagg)

Changed

  • Use readable-stream from user land across all node version (@rvagg)

0.18.1 - 2013-11-20

Changed

  • Make chained-batch obey global LevelUP object options (@mcavage)

0.18.0 - 2013-11-18

Changed

0.17.0 - 2013-10-01

Changed

  • Undo factory pattern, use plain prototypal object and expose full prototype (@rvagg)
  • Move Batch object to batch.js and expose (@rvagg)
  • Use new package, DeferredLevelDOWN to handle all deferred open logic (@rvagg)
  • Code cleanup, update deps (xtend) (@rvagg, @juliangruber)

0.16.0 - 2013-09-10

Added

  • Add notFound boolean property and status=404 property to NotFoundError (@rvagg)

Changed

  • Upgrade to `errno@0.1.0which aliases.typeand.name` properties (@rvagg)
  • ReadStream gracefully handles multiple destroy() calls (@mcollina)

0.15.0 - 2013-08-26

Added

Changed

  • New ReadStream: upgrade to streams2, remove all state-management cruft, remove fstream support (@substack)
  • Upgrade LevelDOWN dependency to ~0.8.0 with Iterator lt/lte/gt/gte support and NAN as a dependency (@rvagg)

0.14.0 - 2013-08-19

Changed

  • Encodings overhaul, allow custom encoders/decoders for keyEncoding or valueEncoding (@dominictarr)

0.13.0 - 2013-08-11

Changed

  • Upgrade LevelDOWN dependency version ~0.7.0 for Node 0.8->0.11 compatibility (@rvagg)

0.12.0 - 2013-07-25

Changed

  • Upgrade LevelDOWN dependency version ~0.6.2 (@rvagg)

0.11.0 - 2013-07-17

Added

  • Add @pgte as contributor

Changed

  • Switch from direct Buffer access to bops for better browser compatibility (@juliangruber)
  • WriteStream#end accepts data argument (@pgte)

Removed

  • Remove all Function#bind calls for better browser compatibility (@juliangruber)

0.10.0 - 2013-06-14

Changed

0.9.0 - 2013-05-21

Changed

Removed

0.8.0 - 2013-04-17

Changed

  • More comprehensive argument checking, will now report back directly or throw if there is a problem rather than on nextTick (@rvagg)
  • Expose .options property on LevelUP instances. (@rvagg)
  • Further clarify 'encoding' -> 'valueEncoding' shift. db.options.valueEncoding is now authoritative even if user used 'encoding' on initialisation. (@rvagg)
  • level package now published to npm that bundles LevelUP and LevelDOWN and exposes LevelUP directly; for planned shift to detaching LevelDOWN as a direct-dependency of LevelUP. (@rvagg)

0.7.0 - 2013-04-08

Added

  • Add windows support in `LevelDOWN@0.2.0` (@rvagg)
  • Add 'db' option on constructor to replace LevelDOWN (@rvagg)
  • Add repair() and destroy() aliases for LevelDOWN implementations (@rvagg)

Changed

  • Improved ReadStream reverse=true start key handling (@kesla)
  • ReadStream empty start and end keys ignored rather than segfault (@kesla)
  • 'encoding' option now an alias for valueEncoding only, keyEncoding defaults to 'utf8' and must be changed explicitly (@rvagg)

Fixed

  • Fix early close emit in WriteStream (@rvagg)

0.6.2 - 2013-03-04

Changed

  • Use xtend package instead of internal util._extend (@ralphtheninja)
  • Internal cleanup of callback argument detection (@ralphtheninja)
  • Move deferred-open-operations into an internal this._db wrapper rather than make them call public .get()/.put() etc. for a second time (@dominictarr)

0.6.1 - 2013-03-01

Changed

Fixed

  • Fix multiple iterator.end() calls in ReadStreams throwing errors, destroy() called while read/next is in progress #82 #83 #84 (@rvagg)

0.6.0 - 2013-02-25

Changed

0.6.0-rc1 - 2013-02-24

Changed

0.5.4 - 2013-02-15

Changed

  • Move encodingOpts from levelup.js to util.js (@ralphtheninja)
  • Allow one next() at a time, improve end() handling (@rvagg)
  • Use explicit namespaces in C++ (@rvagg)

Removed

Fixed

  • Fix put/batch bug in WriteStream#_process() (@ralphtheninja)
  • Fix memory leak, Persistent<Function> callback not Dispose()d for readStream() (@rvagg)

0.5.3 - 2013-01-28

Changed

  • Disable all sqlite3 benchmarks (@ralphtheninja)
  • Put LevelUP() into closure (@ralphtheninja)
  • Swap bufferstream dependency for simple-bufferstream (@rvagg)
  • Make location a read-only property on db object (@rvagg)

0.5.3-1 - 2013-02-05

Changed

  • Non shrinkwrapped release @rvagg

0.5.2 - 2013-01-23

Fixed

  • Fix incorrect scope in approximateSize function (@sandfox)

0.5.1 - 2013-01-10

Changed

0.5.0 - 2013-01-08

Added

  • Add support for setting size of LRU-cache (@kesla)

Changed

Fixed

  • Idempotent open and close, and emit _state as events (@dominictarr)
  • Check that UINT32_OPTION_VALUE is a Uint32 (@kesla)

0.5.0-1 - 2013-01-09

Changed

  • Change createIfMissing option default to true (@rvagg)
  • Use util._extend instead of local variant (@rvagg)

0.4.4 - 2013-01-01

Fixed

  • Set .maxListeners to Infinity to prevent warnings when using deferred open (@juliangruber)

0.4.3 - 2012-12-30

Added

0.4.2 - 2012-12-30

Added

Fixed

  • Use setImmediate instead of process.nextTick for `node@0.9.5` compatibility (@rvagg)

0.4.1 - 2012-12-19

Removed

  • Remove useBatch option on writeStream() @rvagg

0.4.0 - 2012-12-17

Added

  • Add SQLite3 to test suite (@rvagg)
  • Add basic get() benchmarks (@rvagg)
  • Add compress boolean on open() (@rvagg)

Changed

  • Speed up batch() and allow non-Strings to C++ (@rvagg)
  • Improved compression test (@rvagg)
  • Return Strings not Buffers from C++ when possible (@rvagg)
  • Optimised encoders and decoders (@rvagg)
  • Revamped benchmark suite (@rvagg)
  • Allow JS Strings through to native layer (@rvagg)
  • Cleaner build for osx (@rvagg)
  • Upgrade to `LevelDB@1.7` (@rvagg)

Removed

  • Remove old and unused util functions (@rvagg)
  • Remove compile warnings on osx (@rvagg)
  • Remove compile warnings for solaris (@rvagg)

Fixed

  • Fix batch() benchmarks (@rvagg)

0.3.3 - 2012-12-14

Added

  • Add compression tests (@rvagg)

Fixed

  • Fix Snappy compression (@rvagg)

0.3.2 - 2012-11-24

Added

  • Add more functional tests (@rvagg)
  • Add snapshot tests (@rvagg)

Changed

  • Emit raw keys and values in events (@rvagg)

0.3.1 - 2012-11-21

Added

  • Add benchmark suite (@rvagg)
  • Add limit option to ReadStream (@rvagg)

0.3.0 - 2012-11-18

Added

Changed

  • Document events (@rvagg)
  • Run the encoding on start and end in case your keys are JSON encoded (@raynos)
  • First attempt at deferring operations. All operations that used to throw when called before open are now called once the database is open (@raynos, @rvagg)

Fixed

  • If status is 'closing', call callback after db is closed (@raynos, @rvagg)

0.2.1 - 2012-10-28

Fixed

  • Fix db GC when using multiple ReadStream (@rvagg)

0.2.0 - 2012-10-28

Added

  • Add support for Solaris/SunOS/SmartOS (@rvagg)

0.1.2 - 2012-10-26

Fixed

  • Fix bug with falsey values on start and end, fixes #8 (@rvagg)

0.1.1 - 2012-10-17

Fixed

  • Fix bug with sticky options, fixes #6 (@rvagg)

0.1.0 - 2012-09-28

Added

  • Add Travis setup (@rvagg)
  • Add KeyStream() and ValueStream() (@rvagg)

0.0.5 - 2012-09-22

Changed

  • Native layer errors if key or value are undefined or null (@rvagg)

0.0.5-1 - 2012-09-28

Added

  • Add description to package.json (@rvagg)

0.0.4 - 2012-09-12

Fixed

  • Fix bug with options not being passed to readable streams (@rvagg)

0.0.3 - 2012-09-09

Added

  • Add reverse functionality to readable streams (@rvagg)

0.0.2 - 2012-09-07

Changed

  • Do not encourage using async throw in documentation (@rvagg)
  • Return to classical prototypal inheritance (@rvagg)

Fixed

  • Fix typos in documentation (@rvagg)

0.0.2-1 - 2012-09-07

Added

  • Add repository information to package.json (@rvagg)

0.0.1 - 2012-08-31

Added

  • Add start and end options for readable streams (@rvagg)
  • Add 'json' encoding (@rvagg)
  • Add .nextLocation(), .checkBinaryTestData(), .loadBinaryTestData(), .openTestDatabase(), .commonTearDown(), .commonSetup() and .binaryTestDataMD5Sum to test/common.js (@rvagg)
  • Add tests for .readStream() with start being midway key (@rvagg)
  • Add keywords to package.json (@rvagg)

Changed

  • New API. Database constructor now accepts callback (@rvagg)
  • Update documentation for new API (@rvagg)

Removed

  • Remove usage of global in tests (@rvagg)

0.0.0 - 2012-08-17

:seedling: Initial release.

0.0.0-1 - 2012-08-18

Added

  • Add bufferstream dependency (@rvagg)

Changed

  • Document ReadStream and WriteStream (@rvagg)
  • Start using ~ in dependencies (@rvagg)

Removed

  • Remove unused inherits variable (@rvagg)