You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 1, 2024. It is now read-only.
* Add dependency-check
* Add Donate section and badges to README.md
* Unlock 7 devDependencies
* Run hallmark
* Tweak badges and links in README.md
* Fix 'Link to unknown heading(s)' in README.md
* Remove README.md from hallmark ignore option
* Run hallmark
[](#backers)
11
+
[](#sponsors)
11
12
12
13
## Table of Contents
13
14
@@ -24,6 +25,7 @@
24
25
-[Support](#support)
25
26
-[Contributing](#contributing)
26
27
-[Big Thanks](#big-thanks)
28
+
-[Donate](#donate)
27
29
-[License](#license)
28
30
29
31
</details>
@@ -34,11 +36,11 @@
34
36
35
37
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](http://google.github.io/snappy/) algorithm.
36
38
37
-
LevelDB stores entries sorted lexicographically by keys. This makes the [streaming interface](#createReadStream) of `levelup` - which exposes LevelDB iterators as [Readable Streams](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) - a very powerful query mechanism.
39
+
LevelDB stores entries sorted lexicographically by keys. This makes the <ahref="#createReadStream">streaming interface</a> of `levelup` - which exposes LevelDB iterators as [Readable Streams](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams) - a very powerful query mechanism.
38
40
39
-
The most common store is [`leveldown`](https://github.com/level/leveldown/) which provides a pure C++ binding to LevelDB. [Many alternative stores are available](https://github.com/Level/awesome/#stores) such as [`level.js`](https://github.com/level/level.js) in the browser or [`memdown`](https://github.com/level/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`](https://github.com/level/encoding-down).
41
+
The most common store is [`leveldown`](https://github.com/Level/leveldown/) which provides a pure C++ binding to LevelDB. [Many alternative stores are available](https://github.com/Level/awesome/#stores) such as [`level.js`](https://github.com/Level/level.js) in the browser or [`memdown`](https://github.com/Level/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`](https://github.com/Level/encoding-down).
40
42
41
-
**The [`level`](https://github.com/level/level) package is the recommended way to get started.** It conveniently bundles `levelup`, [`leveldown`](https://github.com/level/leveldown/) and [`encoding-down`](https://github.com/level/encoding-down). Its main export is `levelup` - i.e. you can do `var db = require('level')`.
43
+
**The [`level`](https://github.com/Level/level) package is the recommended way to get started.** It conveniently bundles `levelup`, [`leveldown`](https://github.com/Level/leveldown/) and [`encoding-down`](https://github.com/Level/encoding-down). Its main export is `levelup` - i.e. you can do `var db = require('level')`.
42
44
43
45
## Supported Platforms
44
46
@@ -81,20 +83,20 @@ db.put('name', 'levelup', function (err) {
@@ -106,7 +108,7 @@ db.put('name', 'levelup', function (err) {
106
108
107
109
The main entry point for creating a new `levelup` instance.
108
110
109
-
-`db` must be an [`abstract-leveldown`](https://github.com/level/abstract-leveldown) compliant store.
111
+
-`db` must be an [`abstract-leveldown`](https://github.com/Level/abstract-leveldown) compliant store.
110
112
-`options` is passed on to the underlying store when opened and is specific to the type of store being used
111
113
112
114
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.
@@ -347,7 +349,7 @@ Legacy options:
347
349
348
350
### `db.createKeyStream([options])`
349
351
350
-
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.
352
+
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 <ahref="#createReadStream"><code>createReadStream</code></a> to control the range and direction.
351
353
352
354
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).
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.
373
+
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 <ahref="#createReadStream"><code>createReadStream</code></a> to control the range and direction.
372
374
373
375
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).
Returns an [`abstract-leveldown` iterator](https://github.com/Level/abstract-leveldown/#abstractleveldown_iteratoroptions), which is what powers the readable streams above. Options are the same as the range options of [`createReadStream()`](#createReadStream) and are passed to the underlying store.
394
+
Returns an [`abstract-leveldown` iterator](https://github.com/Level/abstract-leveldown/#abstractleveldown_iteratoroptions), which is what powers the readable streams above. Options are the same as the range options of <ahref="#createReadStream"><code>createReadStream</code></a> and are passed to the underlying store.
393
395
394
396
<aname="writeStreams"></a>
395
397
396
398
#### What happened to `db.createWriteStream`?
397
399
398
-
`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](https://github.com/level/levelup/issues/199), removing it was the best course of action.
400
+
`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](https://github.com/Level/levelup/issues/199), removing it was the best course of action.
399
401
400
402
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.
401
403
402
-
Check out the implementations that the community has already produced [here](https://github.com/level/levelup/wiki/Modules#write-streams).
404
+
Check out the implementations that the community has already produced [here](https://github.com/Level/levelup/wiki/Modules#write-streams).
403
405
404
406
## Promise Support
405
407
@@ -462,13 +464,13 @@ db.on('put', function (key, value) {
462
464
463
465
## Extending
464
466
465
-
A list of <ahref="https://github.com/level/levelup/wiki/Modules"><b>Level modules and projects</b></a> can be found in the wiki. We are in the process of moving all this to [`awesome`](https://github.com/Level/awesome/).
467
+
A list of <ahref="https://github.com/Level/levelup/wiki/Modules"><b>Level modules and projects</b></a> can be found in the wiki. We are in the process of moving all this to [`awesome`](https://github.com/Level/awesome/).
466
468
467
469
## Multi-process Access
468
470
469
471
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.
470
472
471
-
See the aformentioned <ahref="https://github.com/level/levelup/wiki/Modules"><b>wiki</b></a> for modules like [multilevel](https://github.com/juliangruber/multilevel), that may help if you require a single store to be shared across processes.
473
+
See the aformentioned <ahref="https://github.com/Level/levelup/wiki/Modules"><b>wiki</b></a> for modules like [multilevel](https://github.com/juliangruber/multilevel), that may help if you require a single store to be shared across processes.
472
474
473
475
## Support
474
476
@@ -492,6 +494,18 @@ Cross-browser Testing Platform and Open Source ♥ Provided by [Sauce Labs](http
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). 💖
0 commit comments