Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

levelup

Package Overview
Dependencies
Maintainers
3
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

levelup - npm Package Compare versions

Comparing version 2.0.0-rc1 to 2.0.0-rc2

lib/levelup.d.ts

12

CHANGELOG.md

@@ -11,2 +11,3 @@ ## 2.0.0 @ Sep 2017

4. Add a native `Promise` API for promise using geeks. Many have been asking for this. Also `async/await` is awesome.
5. Add `typescript` definitions and run the tests through `ts-node`.

@@ -75,2 +76,13 @@ Point `1` and `2` also helps out with reducing complexity.

* [[`1a835c4b28`](https://github.com/level/levelup/commit/1a835c4b28)] - now ts-test works with faucet (Lars-Magnus Skog)
* [[`4232e3f522`](https://github.com/level/levelup/commit/4232e3f522)] - optimize typescript tests (Vincent Weevers)
* [[`1f6522aa59`](https://github.com/level/levelup/commit/1f6522aa59)] - use path.join (Lars-Magnus Skog)
* [[`5fab29b531`](https://github.com/level/levelup/commit/5fab29b531)] - leave out buster code from ts-test, rename to typescript.js, remove faucet :truck: (Lars-Magnus Skog)
* [[`826e9fbd26`](https://github.com/level/levelup/commit/826e9fbd26)] - **feat**: add typescript definitions and testing (Meirion Hughes)
* [[`67bdcb7314`](https://github.com/level/levelup/commit/67bdcb7314)] - fix(package): update level-errors to version 1.1.0 (greenkeeper[bot])
* [[`78a9ac7615`](https://github.com/level/levelup/commit/78a9ac7615)] - remove node 7 from travis, no longer active (Lars-Magnus Skog)
* [[`72e98027ce`](https://github.com/level/levelup/commit/72e98027ce)] - **readme**: tweak node badge (Lars-Magnus Skog)
* [[`a021143652`](https://github.com/level/levelup/commit/a021143652)] - **readme**: add node version badge (Lars-Magnus Skog)
* [[`4ec5572f94`](https://github.com/level/levelup/commit/4ec5572f94)] - **readme**: homogenize (first pass) (Vincent Weevers)
* [[`e152d83ce6`](https://github.com/level/levelup/commit/e152d83ce6)] - 2.0.0-rc1 (Lars-Magnus Skog)
* [[`1dda39eb17`](https://github.com/level/levelup/commit/1dda39eb17)] - rename test for maybeError() for clarity (Lars-Magnus Skog)

@@ -77,0 +89,0 @@ * [[`77f027de38`](https://github.com/level/levelup/commit/77f027de38)] - ignore temporary dbs in test folder (Lars-Magnus Skog)

4

lib/levelup.js

@@ -64,2 +64,4 @@ /* Copyright (c) 2012-2017 LevelUP contributors

LevelUP.prototype.emit = EventEmitter.prototype.emit
LevelUP.prototype.once = EventEmitter.prototype.once
inherits(LevelUP, EventEmitter)

@@ -292,3 +294,3 @@

LevelUP.errors = errors
module.exports = LevelUP
module.exports.errors = errors
{
"name": "levelup",
"description": "Fast & simple storage - a Node.js-style LevelDB wrapper",
"version": "2.0.0-rc1",
"version": "2.0.0-rc2",
"contributors": [

@@ -19,3 +19,4 @@ "Rod Vagg <r@va.gg> (https://github.com/rvagg)",

"James Halliday <mail@substack.net> (https://github.com/substack)",
"Jarrett Cruger <jcrugzz@gmail.com> (https://github.com/jcrugzz)"
"Jarrett Cruger <jcrugzz@gmail.com> (https://github.com/jcrugzz)",
"Meirion Hughes <crakinshot@yahoo.com> (https://github.com/meirionhughes)"
],

@@ -37,5 +38,6 @@ "repository": {

"main": "lib/levelup.js",
"typings": "lib/levelup.d.ts",
"dependencies": {
"deferred-leveldown": "~2.0.0",
"level-errors": "~1.0.3",
"level-errors": "~1.1.0",
"level-iterator-stream": "~2.0.0",

@@ -45,2 +47,3 @@ "xtend": "~4.0.0"

"devDependencies": {
"@types/node": "^8.0.26",
"after": "^0.8.2",

@@ -62,8 +65,14 @@ "async": "^2.5.0",

"standard": "^10.0.2",
"tape": "^4.7.0"
"tape": "^4.7.0",
"ts-node": "^3.3.0",
"typescript": "^2.5.2"
},
"scripts": {
"test": "standard && tape test/*-test.js | faucet"
"test": "standard && node test | faucet && npm run ts-test",
"ts-test": "ts-node --no-cache test | faucet"
},
"engines": {
"node": ">=6.0.0"
},
"license": "MIT"
}

@@ -8,2 +8,3 @@ LevelUP

![Node version](https://img.shields.io/node/v/levelup.svg)
[![Build Status](https://secure.travis-ci.org/Level/levelup.svg?branch=master)](http://travis-ci.org/Level/levelup)

@@ -36,7 +37,7 @@ [![dependencies](https://david-dm.org/Level/levelup.svg)](https://david-dm.org/level/levelup)

**[LevelDB](https://github.com/google/leveldb)** is a simple key/value data store built by Google, inspired by BigTable. 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.
**[LevelDB](https://github.com/google/leveldb)** is a simple key-value store built by Google, inspired by BigTable. 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.
**LevelUP** aims to expose the features of LevelDB in a **Node.js-friendly way**. LevelDB's iterators are exposed as a Node.js-style **readable stream**.
**LevelUP** aims to expose the features of LevelDB in a **Node.js-friendly way**. LevelDB's iterators are exposed as [Readable Streams](https://nodejs.org/docs/latest/api/stream.html#stream_readable_streams).
LevelDB stores entries **sorted lexicographically by keys**. This makes LevelUP's <a href="#createReadStream"><code>ReadStream</code></a> interface a very powerful query mechanism.
LevelDB stores entries **sorted lexicographically by keys**. This makes LevelUP's [streaming interface](#createReadStream) a very powerful query mechanism.

@@ -166,3 +167,3 @@ **LevelUP** is an **OPEN Open Source Project**, see the <a href="#contributing">Contributing</a> section to find out what this means.

### db.open([callback])
<code>open()</code> opens the underlying LevelDB store. In general **you should never need to call this method directly** as it's automatically called by <a href="#ctor"><code>levelup()</code></a>.
<code>open()</code> opens the underlying store. In general **you should never need to call this method directly** as it's automatically called by <a href="#ctor"><code>levelup()</code></a>.

@@ -176,3 +177,3 @@ However, it is possible to *reopen* a database after it has been closed with <a href="#close"><code>close()</code></a>, although this is not generally advised.

### db.close([callback])
<code>close()</code> closes the underlying LevelDB store. The callback will receive any error encountered during closing as the first argument.
<code>close()</code> closes the underlying store. The callback will receive any error encountered during closing as the first argument.

@@ -326,3 +327,3 @@ You should always clean up your LevelUP instance by calling `close()` when you no longer need it to free up resources. A LevelDB store cannot be opened by multiple instances of LevelDB/LevelUP simultaneously.

You can obtain a **ReadStream** of the full database by calling the `createReadStream()` method. The resulting stream is a complete Node.js-style [Readable Stream](http://nodejs.org/docs/latest/api/stream.html#stream_readable_stream) where `'data'` events emit objects with `'key'` and `'value'` pairs. You can also use the `gt`, `lt` and `limit` options to control the range of keys that are streamed.
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 database from start to end. Use the options described below to control the range, direction and results.

@@ -345,20 +346,22 @@ ```js

The standard `pause()`, `resume()` and `destroy()` methods are implemented on the ReadStream, as is `pipe()` (see below). `'data'`, '`error'`, `'end'` and `'close'` events are emitted.
You can supply an options object as the first parameter to `createReadStream()` with the following properties:
Additionally, you can supply an options object as the first parameter to `createReadStream()` with the following options:
* `'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 records 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 records 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 key/value pairs 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 records streamed will be the same.
* `'reverse'` *(boolean, default: `false`)*: stream entries in reverse order. Beware that due to the way LevelDB works, a reverse seek will be slower than a forward seek.
* `'start', 'end'` legacy ranges - instead use `'gte', 'lte'`
* `'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.
* `'reverse'` *(boolean, default: `false`)*: a boolean, set true and the stream output will be reversed. Beware that due to the way LevelDB works, a reverse seek will be slower than a forward seek.
* `'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 `'data'` event should contain keys. If set to `true` and `'values'` set to `false` then `'data'` events 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 `'data'` event should contain values. If set to `true` and `'keys'` set to `false` then `'data'` events will simply be values, rather than objects with a `'value'` property. Used internally by the `createValueStream()` method.
Legacy options:
* `'limit'` *(number, default: `-1`)*: limit the number of results collected by this stream. This number represents a *maximum* number of results and may not be reached if you get to the end of the data first. A value of `-1` means there is no limit. When `reverse=true` the highest keys will be returned instead of the lowest keys.
* `'start'`: instead use `'gte'`
* `'end'`: instead use `'lte'`
--------------------------------------------------------

@@ -368,5 +371,5 @@ <a name="createKeyStream"></a>

A **KeyStream** is a **ReadStream** where the `'data'` events are simply the keys from the database so it can be used like a traditional stream rather than an object stream.
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.
You can obtain a KeyStream either by calling the `createKeyStream()` method on a LevelUP object or by passing an options object to `createReadStream()` with `keys` set to `true` and `values` set to `false`.
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).

@@ -390,5 +393,5 @@ ```js

A **ValueStream** is a **ReadStream** where the `'data'` events are simply the values from the database so it can be used like a traditional stream rather than an object stream.
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.
You can obtain a ValueStream either by calling the `createValueStream()` method on a LevelUP object or by passing an options object to `createReadStream()` with `values` set to `true` and `keys` set to `false`.
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).

@@ -490,3 +493,3 @@ ```js

See the <a href="https://github.com/level/levelup/wiki/Modules"><b>wiki</b></a> for some LevelUP extensions, including [multilevel](https://github.com/juliangruber/multilevel), that may help if you require a single data store to be shared across processes.
See the <a href="https://github.com/level/levelup/wiki/Modules"><b>wiki</b></a> for some LevelUP extensions, including [multilevel](https://github.com/juliangruber/multilevel), that may help if you require a single store to be shared across processes.

@@ -493,0 +496,0 @@ <a name="support"></a>

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc