From 9780456778302e007ab4f4e76ecb226c6f7bda7e Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 16:13:23 +0100 Subject: [PATCH 1/9] Remove redundant Contributors section from README --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index 707c712..ce5105e 100644 --- a/README.md +++ b/README.md @@ -442,12 +442,6 @@ db.on('put', function (key, value) { See the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details. -## Contributors - -This project exists thanks to all the people who contribute. [Contribute](CONTRIBUTING.md). - - - ## Backers Thank you to all our backers! 🙏 [Become a backer](https://opencollective.com/level#backer) From ce3e563b6b6ed4190a3a736998756e1fc8c595e3 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:05:34 +0100 Subject: [PATCH 2/9] Remove Open Collective's ISSUE_TEMPLATE.md --- .github/ISSUE_TEMPLATE.md | 2 -- 1 file changed, 2 deletions(-) delete mode 100644 .github/ISSUE_TEMPLATE.md diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md deleted file mode 100644 index 0c50bb9..0000000 --- a/.github/ISSUE_TEMPLATE.md +++ /dev/null @@ -1,2 +0,0 @@ - \ No newline at end of file From 4ec5c3ad386391bc5d334edb627cdc1244bda1ef Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:06:44 +0100 Subject: [PATCH 3/9] Tweak Open Collective and badges in README.md --- README.md | 36 +++++++++++++----------------------- 1 file changed, 13 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index ce5105e..6de2334 100644 --- a/README.md +++ b/README.md @@ -3,16 +3,15 @@ > Fast & simple storage. A Node.js-style `LevelDB` wrapper for Node.js, Electron and browsers. [![level badge][level-badge]](https://github.com/level/awesome) -[![Backers on Open Collective](https://opencollective.com/level/backers/badge.svg)](#backers) -[![Sponsors on Open Collective](https://opencollective.com/level/sponsors/badge.svg)](#sponsors) -[![npm](https://img.shields.io/npm/v/level.svg)](https://www.npmjs.com/package/level) -![Node version](https://img.shields.io/node/v/level.svg) -[![Travis](https://img.shields.io/travis/Level/level.svg?label=travis)](http://travis-ci.org/Level/level) -[![AppVeyor](https://img.shields.io/appveyor/ci/Level/level.svg?label=appveyor)](https://ci.appveyor.com/project/Level/level) -[![dependencies](https://david-dm.org/Level/level.svg)](https://david-dm.org/level/level) +[![npm](https://img.shields.io/npm/v/level.svg?label=&logo=npm)](https://www.npmjs.com/package/level) +[![Node version](https://img.shields.io/node/v/level.svg)](https://www.npmjs.com/package/level) +[![Travis](https://img.shields.io/travis/Level/level.svg?logo=travis&label=)](http://travis-ci.org/Level/level) +[![AppVeyor](https://img.shields.io/appveyor/ci/Level/level.svg?logo=appveyor&label=)](https://ci.appveyor.com/project/Level/level) [![Coverage Status](https://coveralls.io/repos/github/Level/level/badge.svg)](https://coveralls.io/github/Level/level) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) -[![npm](https://img.shields.io/npm/dm/level.svg)](https://www.npmjs.com/package/level) +[![npm](https://img.shields.io/npm/dm/level.svg?label=dl)](https://www.npmjs.com/package/level) +[![Backers on Open Collective](https://opencollective.com/level/backers/badge.svg?color=orange)](#backers) +[![Sponsors on Open Collective](https://opencollective.com/level/sponsors/badge.svg?color=orange)](#sponsors) ## Table of Contents @@ -442,26 +441,17 @@ db.on('put', function (key, value) { See the [Contribution Guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details. -## Backers +## Donate -Thank you to all our backers! 🙏 [Become a backer](https://opencollective.com/level#backer) +To sustain [`Level`](https://github.com/Level) and its activities, become a backer or sponsor on [Open Collective](https://opencollective.com/level). Your logo or avatar will be displayed on our 28+ [GitHub repositories](https://github.com/Level), [npm](https://www.npmjs.com/) packages and (soon) [our website](http://leveldb.org). 💖 - +### Backers -## Sponsors +[![Open Collective backers](https://opencollective.com/level/backers.svg?width=890)](https://opencollective.com/level) -Support this project by [becoming a sponsor](https://opencollective.com/level#sponsor). Your logo will show up here with a link to your website. +### Sponsors - - - - - - - - - - +[![Open Collective sponsors](https://opencollective.com/level/sponsors.svg?width=890)](https://opencollective.com/level) ## License From 65064605038a97c0a36beb8cd9dd0d3027e18931 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:39:01 +0100 Subject: [PATCH 4/9] Fix 'Reference to undefined definition' in README.md --- README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 6de2334..6223d00 100644 --- a/README.md +++ b/README.md @@ -244,27 +244,27 @@ db.batch() .write(function () { console.log('Done!') }) ``` -batch.put(key, value) +**`batch.put(key, value)`** Queue a *put* operation on the current batch, not committed until a `write()` is called on the batch. 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) +**`batch.del(key)`** Queue a *del* operation on the current batch, not committed until a `write()` is called on the batch. This method may `throw` a `WriteError` if there is a problem with your delete. -batch.clear() +**`batch.clear()`** Clear all queued operations on the current batch, any previous operations will be discarded. -batch.length +**`batch.length`** The number of queued operations on the current batch. -batch.write([options][, callback]) +**`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. From 9cf0dea8682e00204cdfc2475189e5552142441a Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:44:16 +0100 Subject: [PATCH 5/9] Fix 'Link to unknown heading(s)' in README.md --- README.md | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 6223d00..fbbc07a 100644 --- a/README.md +++ b/README.md @@ -79,19 +79,19 @@ If you want to use [Promises](#promise-support), you will need a polyfill like [ For options specific to [`leveldown`][leveldown] and [`level-js`][level-js] ("underlying store" from here on out), please see their respective READMEs. -* [level()](#ctor) -* [db.open()](#open) -* [db.close()](#close) -* [db.put()](#put) -* [db.get()](#get) -* [db.del()](#del) -* [db.batch() *(array form)*](#batch) -* [db.batch() *(chained form)*](#batch_chained) -* [db.isOpen()](#isOpen) -* [db.isClosed()](#isClosed) -* [db.createReadStream()](#createReadStream) -* [db.createKeyStream()](#createKeyStream) -* [db.createValueStream()](#createValueStream) +* level() +* db.open() +* db.close() +* db.put() +* db.get() +* db.del() +* db.batch() *(array form)* +* db.batch() *(chained form)* +* db.isOpen() +* db.isClosed() +* db.createReadStream() +* db.createKeyStream() +* db.createValueStream() ### `db = level(location[, options[, callback]])` @@ -337,7 +337,7 @@ Underlying stores may have additional options. ### `db.createKeyStream([options])` -Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) of keys rather than key-value pairs. Use the same options as described for [`createReadStream`](#createReadStream) to control the range and direction. +Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) 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](https://nodejs.org/docs/latest/api/stream.html#stream_object_mode). @@ -357,7 +357,7 @@ db.createReadStream({ keys: true, values: false }) ### `db.createValueStream([options])` -Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) of values rather than key-value pairs. Use the same options as described for [`createReadStream`](#createReadStream) to control the range and direction. +Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) 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](https://nodejs.org/docs/latest/api/stream.html#stream_object_mode). From 85573f9cb2a6953b87c041c9a733901a66784b6d Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:46:21 +0100 Subject: [PATCH 6/9] Fix 'Unused definition' in README.md --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index fbbc07a..9e4621c 100644 --- a/README.md +++ b/README.md @@ -458,7 +458,6 @@ To sustain [`Level`](https://github.com/Level) and its activities, become a back [MIT](LICENSE.md) © 2013-present Rod Vagg and [Contributors](CONTRIBUTORS.md). [level-badge]: http://leveldb.org/img/badge.svg -[levelup]: https://github.com/level/levelup [leveldown]: https://github.com/level/leveldown [level-js]: https://github.com/level/level-js [encoding-down]: https://github.com/level/encoding-down From 3a69d7fa1e7067aa5ddc832be9a6e7df3b3d492c Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:47:20 +0100 Subject: [PATCH 7/9] Remove CONTRIBUTING.md --- CONTRIBUTING.md | 67 ------------------------------------------------- 1 file changed, 67 deletions(-) delete mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md deleted file mode 100644 index 8c28d93..0000000 --- a/CONTRIBUTING.md +++ /dev/null @@ -1,67 +0,0 @@ -# Contribute - -## Introduction - -First, thank you for considering contributing to level! It's people like you that make the open source community such a great community! 😊 - -We welcome any type of contribution, not only code. You can help with -- **QA**: file bug reports, the more details you can give the better (e.g. screenshots with the console open) -- **Marketing**: writing blog posts, howto's, printing stickers, ... -- **Community**: presenting the project at meetups, organizing a dedicated meetup for the local community, ... -- **Code**: take a look at the [open issues](issues). Even if you can't write code, commenting on them, showing that you care about a given issue matters. It helps us triage them. -- **Money**: we welcome financial contributions in full transparency on our [open collective](https://opencollective.com/level). - -## Your First Contribution - -Working on your first Pull Request? You can learn how from this *free* series, [How to Contribute to an Open Source Project on GitHub](https://egghead.io/series/how-to-contribute-to-an-open-source-project-on-github). - -## Submitting code - -Any code change should be submitted as a pull request. The description should explain what the code does and give steps to execute it. The pull request should also contain tests. - -## Code review process - -The bigger the pull request, the longer it will take to review and merge. Try to break down large pull requests in smaller chunks that are easier to review and merge. -It is also always helpful to have some context for your pull request. What was the purpose? Why does it matter to you? - -## Financial contributions - -We also welcome financial contributions in full transparency on our [open collective](https://opencollective.com/level). -Anyone can file an expense. If the expense makes sense for the development of the community, it will be "merged" in the ledger of our open collective by the core contributors and the person who filed the expense will be reimbursed. - -## Questions - -If you have any questions, create an [issue](issue) (protip: do a quick search first to see if someone else didn't ask the same question before!). -You can also reach us at hello@level.opencollective.com. - -## Credits - -### Contributors - -Thank you to all the people who have already contributed to level! - - - -### Backers - -Thank you to all our backers! [[Become a backer](https://opencollective.com/level#backer)] - - - - -### Sponsors - -Thank you to all our sponsors! (please ask your company to also support this open source project by [becoming a sponsor](https://opencollective.com/level#sponsor)) - - - - - - - - - - - - - From f599095bc90d328f72e3e18da710b3bb1ee161d1 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:48:08 +0100 Subject: [PATCH 8/9] Remove CONTRIBUTING.md and README.md from hallmark ignore option --- package.json | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/package.json b/package.json index 0540707..d53affe 100644 --- a/package.json +++ b/package.json @@ -36,11 +36,7 @@ "logo": "https://opencollective.com/level/logo.txt" }, "hallmark": { - "community": "level-community", - "ignore": [ - "CONTRIBUTING.md", - "README.md" - ] + "community": "level-community" }, "repository": { "type": "git", From 5bc858c8b42b7d0b63256e3ad31d974025845a95 Mon Sep 17 00:00:00 2001 From: Vincent Weevers Date: Sat, 5 Jan 2019 20:49:03 +0100 Subject: [PATCH 9/9] Run hallmark --- README.md | 128 ++++++++++++++++++++++++++++++++---------------------- 1 file changed, 75 insertions(+), 53 deletions(-) diff --git a/README.md b/README.md index 9e4621c..59f60c9 100644 --- a/README.md +++ b/README.md @@ -15,20 +15,17 @@ ## Table of Contents -
-Click to expand - -* [Introduction](#introduction) -* [Usage](#usage) -* [Supported Platforms](#supported-platforms) -* [API](#api) -* [Promise Support](#promise-support) -* [Events](#events) -* [Contributing](#contributing) -* [Contributors](#contributors) -* [Backers](#backers) -* [Sponsors](#sponsors) -* [License](#license) +
Click to expand + +- [Introduction](#introduction) +- [Usage](#usage) +- [Supported Platforms](#supported-platforms) +- [API](#api) +- [Promise Support](#promise-support) +- [Events](#events) +- [Contributing](#contributing) +- [Donate](#donate) +- [License](#license)
@@ -36,9 +33,9 @@ This is a convenience package that: -* exports a function that returns a [`levelup`](https://github.com/level/levelup#ctor) instance when invoked -* bundles the current release of [`leveldown`][leveldown] and [`level-js`][level-js] -* leverages encodings using [`encoding-down`][encoding-down]. +- exports a function that returns a [`levelup`](https://github.com/level/levelup#ctor) instance when invoked +- bundles the current release of [`leveldown`][leveldown] and [`level-js`][level-js] +- leverages encodings using [`encoding-down`][encoding-down]. Use this package to avoid having to explicitly install `leveldown` and/or `level-js` when you just want to use `levelup`. It uses `leveldown` in Node.js or Electron and `level-js` in browsers (when bundled by [`browserify`](https://github.com/browserify/browserify) or similar). @@ -79,22 +76,24 @@ If you want to use [Promises](#promise-support), you will need a polyfill like [ For options specific to [`leveldown`][leveldown] and [`level-js`][level-js] ("underlying store" from here on out), please see their respective READMEs. -* level() -* db.open() -* db.close() -* db.put() -* db.get() -* db.del() -* db.batch() *(array form)* -* db.batch() *(chained form)* -* db.isOpen() -* db.isClosed() -* db.createReadStream() -* db.createKeyStream() -* db.createValueStream() +- level() +- db.open() +- db.close() +- db.put() +- db.get() +- db.del() +- db.batch() _(array form)_ +- db.batch() _(chained form)_ +- db.isOpen() +- db.isClosed() +- db.createReadStream() +- db.createKeyStream() +- db.createValueStream() + ### `db = level(location[, options[, callback]])` + The main entry point for creating a new `levelup` instance. - `location` is a string pointing to the LevelDB location to be opened or in browsers, the name of the [`IDBDatabase`](https://developer.mozilla.org/en-US/docs/Web/API/IDBDatabase) to be opened. @@ -141,15 +140,19 @@ level('my-db', { createIfMissing: false }, function (err, db) { Note that `createIfMissing` is an option specific to [`leveldown`][leveldown]. + ### `db.open([callback])` + Opens the underlying store. In general you should never 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(), although this is not generally advised. +However, it is possible to _reopen_ the store after it has been closed with close(), although this is not generally advised. 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. @@ -157,7 +160,9 @@ You should always clean up your `levelup` instance by calling `close()` when you 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 @@ -166,7 +171,9 @@ If no callback is passed, a promise is returned. If no callback is passed, a promise is returned. + ### `db.get(key[, options][, callback])` + get() is the primary method for fetching data from the store. 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`. ```js @@ -190,8 +197,11 @@ db.get('foo', function (err, value) { If no callback is passed, a promise is returned. + ### `db.del(key[, options][, callback])` + del() is the primary method for removing data from the store. + ```js db.del('foo', function (err) { if (err) @@ -205,10 +215,12 @@ db.del('foo', function (err) { 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. +### `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. ```js var ops = [ @@ -231,7 +243,9 @@ db.batch(ops, function (err) { If no callback is passed, a promise is returned. -### `db.batch()` *(chained form)* + +### `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. ```js @@ -246,13 +260,13 @@ db.batch() **`batch.put(key, value)`** -Queue a *put* operation on the current batch, not committed until a `write()` is called on the batch. +Queue a _put_ operation on the current batch, not committed until a `write()` is called on the batch. 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)`** -Queue a *del* operation on the current batch, not committed until a `write()` is called on the batch. +Queue a _del_ operation on the current batch, not committed until a `write()` is called on the batch. This method may `throw` a `WriteError` if there is a problem with your delete. @@ -266,7 +280,7 @@ 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. +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. - `options` is passed on to the underlying store. - `options.keyEncoding` and `options.valueEncoding` are not supported here. @@ -274,24 +288,27 @@ Commit the queued operations for this batch. All operations not *cleared* will b If no callback is passed, a promise is returned. + ### `db.isOpen()` A `levelup` instance can be in one of the following states: - * *"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, should not be used +- _"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, should not be used `isOpen()` will return `true` only when the state is "open". + ### `db.isClosed()` -`isClosed()` will return `true` only when the state is "closing" *or* "closed", it can be useful for determining if read and write operations are permissible. +`isClosed()` will return `true` only when the state is "closing" _or_ "closed", it can be useful for determining if read and write operations are permissible. + ### `db.createReadStream([options])` Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) 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. @@ -314,27 +331,28 @@ db.createReadStream() 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. +- `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. +- `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. +- `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. +- `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. +- `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. +- `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. Legacy options: -* `start`: instead use `gte` +- `start`: instead use `gte` -* `end`: instead use `lte` +- `end`: instead use `lte` Underlying stores may have additional options. + ### `db.createKeyStream([options])` Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) of keys rather than key-value pairs. Use the same options as described for createReadStream to control the range and direction. @@ -355,6 +373,7 @@ db.createReadStream({ keys: true, values: false }) ``` + ### `db.createValueStream([options])` Returns a [Readable Stream](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) of values rather than key-value pairs. Use the same options as described for createReadStream to control the range and direction. @@ -415,7 +434,7 @@ var main = async () => { `levelup` is an [`EventEmitter`](https://nodejs.org/api/events.html) 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) | @@ -458,6 +477,9 @@ To sustain [`Level`](https://github.com/Level) and its activities, become a back [MIT](LICENSE.md) © 2013-present Rod Vagg and [Contributors](CONTRIBUTORS.md). [level-badge]: http://leveldb.org/img/badge.svg + [leveldown]: https://github.com/level/leveldown + [level-js]: https://github.com/level/level-js + [encoding-down]: https://github.com/level/encoding-down