New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

levelup

Package Overview
Dependencies
Maintainers
1
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 0.14.0 to 0.15.0

94

CHANGELOG.md

@@ -1,15 +0,21 @@

0.14.0 @ Aug 19 2013
====================
### 0.15.0 @ Aug 25 2013
* New ReadStream: upgrade to streams2, remove all state-management cruft, remove fstream support (@substack)
* Update LevelDOWN dependency to ~0.8.0 with Iterator lt/lte/gt/gte support and NAN as a dependency
* Added @substack as contributor
### 0.14.0 @ Aug 19 2013
* Encodings overhaul, allow custom encoders/decoders for `keyEncoding` or `valueEncoding` (@dominictarr)
0.13.0 @ Aug 11 2013
====================
### 0.13.0 @ Aug 11 2013
* Update LevelDOWN dependency version ~0.7.0 for Node 0.8->0.11 compatibility
0.12.0 @ Jul 25 2013
====================
### 0.12.0 @ Jul 25 2013
* Update LevelDOWN dependency version ~0.6.2
0.11.0 @ Jul 17 2013
====================
### 0.11.0 @ Jul 17 2013
* Remove all Function#bind calls for better browser compatibility (@juliangruber)

@@ -20,8 +26,8 @@ * Switch from direct Buffer access to bops for better browser compatibility (@juliangruber)

0.10.0 @ Jun 14 2013
===================
### 0.10.0 @ Jun 14 2013
* Upgrade to LevelDOWN@0.6.0 which upgrades to LevelDB@1.11.0, some important bugfixes: https://groups.google.com/forum/#!topic/leveldb/vS1JvmGlp4E
0.9.0 @ 21 May 2013
===================
### 0.9.0 @ 21 May 2013
* Use LevelDOWN@0.5.0, see https://github.com/rvagg/node-leveldown/blob/master/CHANGELOG.md for details

@@ -40,4 +46,4 @@ * Race-condition(ish) fixed in ReadStream--createReadStream() does not start immediately and therefore allowed put()s to happen before the stream starts (@dominictarr)

0.8.0 @ 17 Apr 2013
===================
### 0.8.0 @ 17 Apr 2013
* More comprehensive argument checking, will now report back directly or throw if there is a problem rather than on nextTick (@rvagg)

@@ -48,4 +54,4 @@ * Expose `.options` property on LevelUP instances. (@rvagg)

0.7.0 @ 8 Apr 2013
==================
### 0.7.0 @ 8 Apr 2013
* Windows support in LevelDOWN @0.2.0 (@rvagg)

@@ -59,4 +65,4 @@ * added 'db' option on constructor to replace LevelDOWN (@rvagg)

0.6.2 @ 4 Mar 2013
==================
### 0.6.2 @ 4 Mar 2013
* use `xtend` package instead of internal util._extend @ralphtheninja

@@ -66,9 +72,9 @@ * internal cleanup of `callback` argument detection @ralphtheninja

0.6.1 @ 1 Mar 2013
==================
### 0.6.1 @ 1 Mar 2013
* internal code cleanup & refactoring @ralphtheninja
* fix multiple iterator.end() calls in ReadStreams throwing errors (destroy() called while read/next is in progress) #82 #83 #84 @rvagg
0.6.0 @ Feb 25 2013
===================
### 0.6.0 @ Feb 25 2013
* complete transition to LevelDOWN for the LevelDB binding. No native code left in LevelUP @rvagg

@@ -79,4 +85,4 @@ - LevelDOWN now keeps its own ChangeLog at: https://github.com/rvagg/node-leveldown/blob/master/CHANGELOG.md

0.5.4 @ Feb 16 2013
===================
### 0.5.4 @ Feb 16 2013
* explicit namespaces in C++ @rvagg

@@ -91,8 +97,8 @@ * memory leak, Persistent<Function> callback not Dispose()d for `readStream()` @rvagg

0.5.3-1 @ Feb 5 2013
====================
### 0.5.3-1 @ Feb 5 2013
* non-shrinkwrapped release @rvagg
0.5.3 @ Jan 28 2013
===================
### 0.5.3 @ Jan 28 2013
* `location` exposed as read-only property on db object @rvagg

@@ -103,8 +109,8 @@ * swap bufferstream dependency for simple-bufferstream, remove unnecessary compile @rvagg

0.5.2 @ Jan 24 2013
===================
### 0.5.2 @ Jan 24 2013
* fix: incorrect scope in approximateSize function @sandfox
0.5.1 @ Jan 10 2013
===================
### 0.5.1 @ Jan 10 2013
* change `createIfMissing` option default to `true` @rvagg

@@ -118,22 +124,22 @@ * use util._extend instead of local variant @rvagg

0.4.4 @ Jan 1 2013
==================
### 0.4.4 @ Jan 1 2013
* set maxListeners to Infinity to prevent warnings when using deferred open @juliangruber
0.4.3 @ Dec 31 2012
===================
### 0.4.3 @ Dec 31 2012
* added @kesla to contributors list @rvagg
* feature: added approximateSize() @kesla
0.4.2 @ Dec 30 2012
===================
### 0.4.2 @ Dec 30 2012
* process.nextTick->setImmediate with polyfill Node 0.9.5 compat @rvagg
* added @ralphtheninja to contributors list @rvagg
0.4.1 @ Dec 20 2013
===================
### 0.4.1 @ Dec 20 2013
* remove `useBatch` option on `writeStream()` @rvagg
0.4.0 @ Dec 18 2013
===================
### 0.4.0 @ Dec 18 2013
* remove old, unused util functions @rvagg

@@ -155,4 +161,4 @@ * speed up batch() & allow non-Strings to C++ @rvagg

0.3.x and prior
===============
### 0.3.x and prior
* stuff

@@ -6,8 +6,6 @@ /* Copyright (c) 2012-2013 LevelUP contributors

var Stream = require('stream').Stream
, bufferStream = require('simple-bufferstream')
var Readable = require('stream').Readable || require('readable-stream').Readable
, inherits = require('util').inherits
, extend = require('xtend')
, errors = require('./errors')
, State = require('./read-stream-state')
, util = require('./util')

@@ -32,10 +30,4 @@

function ReadStream (options, db, iteratorFactory) {
Stream.call(this)
Readable.call(this, { objectMode: true, highWaterMark: options.highWaterMark })
this._state = State()
this._dataEvent = 'data'
this.readable = true
this.writable = false
// purely to keep `db` around until we're done so it's not GCed if the user doesn't keep a ref

@@ -66,103 +58,51 @@ this._db = db

var self = this
var ready = function () {
if (!self._state.canEmitData())
return
self._state.ready()
self._iterator = iteratorFactory(self._options)
self._read()
}
if (db.isOpen())
ready()
else
db.once('ready', ready)
if (!this._db.isOpen()) {
this._db.once('ready', function () {
self._iterator = iteratorFactory(self._options)
})
} else
this._iterator = iteratorFactory(this._options)
}
inherits(ReadStream, Stream)
inherits(ReadStream, Readable)
ReadStream.prototype.destroy = function () {
this._state.destroy()
if (this._state.canCleanup())
this._cleanup()
}
ReadStream.prototype.pause = function () {
if (this._state.canPause()) {
this._state.pause()
this.emit('pause')
}
}
ReadStream.prototype.resume = function () {
if (this._state.canResume()) {
this.emit('resume')
this._state.resume()
this._read()
}
}
ReadStream.prototype.pipe = function (dest) {
if (typeof dest.add == 'function' && this._options.type == 'fstream') {
this._dataEvent = 'entry'
var self = this
this.on('entry', function (data) {
var entry = bufferStream(new Buffer(data.value))
entry.path = data.key.toString()
entry.type = 'File'
entry.props = {
type: 'File'
, path: data.key.toString()
}
entry.pause()
if (dest.add(entry) === false)
self.pause()
})
}
return Stream.prototype.pipe.apply(this, arguments)
}
ReadStream.prototype._read = function () {
ReadStream.prototype._read = function read () {
var self = this
if (this._state.canRead()) {
this._state.read()
this._iterator.next(function(err, key, value) {
self._onData(err, key, value)
})
if (!self._db.isOpen()) {
return self._db.once('ready', function () { read.call(self) })
}
}
if (self._destroyed)
return
self._iterator.next(function(err, key, value) {
if (err || (key === undefined && value === undefined)) {
if (!err && !self._destroyed)
self.push(null)
return self._cleanup(err)
}
ReadStream.prototype._onData = function (err, key, value) {
this._state.endRead()
if (err || (key === undefined && value === undefined) || !this._state.canEmitData())
return this._cleanup(err)
this._read() // queue another read even tho we may not need it
try {
value = this._makeData(key, value)
} catch (e) {
return this.emit('error', new errors.EncodingError(e))
}
this.emit(this._dataEvent, value)
try {
value = self._makeData(key, value)
} catch (e) {
return self._cleanup(new errors.EncodingError(e))
}
if (!self._destroyed)
self.push(value)
})
}
ReadStream.prototype._cleanup = function (err) {
var self = this
if (err)
this.emit('error', err)
self.emit('error', err)
if (!this._state.canEnd())
return
self._iterator.end(function () {
self._iterator = null
self.emit('close')
})
}
this._state.end()
this.readable = false
this.emit('end')
if (this._iterator) {
var self = this
this._iterator.end(function () {
self._iterator = null
self.emit('close')
})
} else
this.emit('close')
ReadStream.prototype.destroy = function () {
this._destroyed = true
this._cleanup()
}

@@ -169,0 +109,0 @@

{
"name" : "levelup"
, "description" : "Fast & simple storage - a Node.js-style LevelDB wrapper"
, "version" : "0.15.0"
, "contributors" : [

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

, "Pedro Teixeira <pedro.teixeira@gmail.com> (https://github.com/pgte)"
, "James Halliday <mail@substack.net> (https://github.com/substack)"
]
, "repository" : {
"type" : "git"
, "url" : "https://github.com/rvagg/node-levelup.git"
}
, "homepage" : "https://github.com/rvagg/node-levelup"
, "keywords": [

@@ -28,3 +35,2 @@ "leveldb"

]
, "version" : "0.14.0"
, "main" : "lib/levelup.js"

@@ -34,3 +40,3 @@ , "dependencies" : {

, "concat-stream" : "~0.1.1"
, "simple-bufferstream" : "~0.0.2"
, "readable-stream" : "~1.0.15"
, "xtend" : "~2.0.3"

@@ -42,3 +48,3 @@ , "prr" : "~0.0.0"

, "devDependencies" : {
"leveldown" : "~0.7.0"
"leveldown" : "~0.8.0"
, "bustermove" : "*"

@@ -65,6 +71,2 @@ , "tap" : "*"

}
, "repository" : {
"type" : "git"
, "url" : "https://github.com/rvagg/node-levelup.git"
}
, "scripts" : {

@@ -71,0 +73,0 @@ "test" : "tap test/*-test.js --stderr"

@@ -44,3 +44,3 @@ LevelUP

LevelUP is designed to be backed by **[LevelDOWN](https://github.com/rvagg/node-leveldown/)** which provides a pure C++ binding to LevelDB and can be used as a stand-along package if required.
LevelUP is designed to be backed by **[LevelDOWN](https://github.com/rvagg/node-leveldown/)** which provides a pure C++ binding to LevelDB and can be used as a stand-alone package if required.

@@ -616,4 +616,4 @@ **As of version 0.9, LevelUP no longer requires LevelDOWN as a dependency so you must `npm install leveldown` when you install LevelUP.**

, decode : function (val) { ... }
, buffer : boolean // true if encode returns a buffer-like and decode accepts a buffer.
, type : string // name of this encoding type.
, buffer : boolean // encode returns a buffer-like and decode accepts a buffer
, type : String // name of this encoding type.
}

@@ -677,2 +677,3 @@ ```

<tr><th align="left">Pedro Teixeira</th><td><a href="https://github.com/pgte">GitHub/pgte</a></td><td><a href="https://twitter.com/pgte">Twitter/@pgte</a></td></tr>
<tr><th align="left">James Halliday</th><td><a href="https://github.com/substack">GitHub/substack</a></td><td><a href="https://twitter.com/substack">Twitter/@substack</a></td></tr>
</tbody></table>

@@ -695,2 +696,1 @@

*LevelUP builds on the excellent work of the LevelDB and Snappy teams from Google and additional contributors. LevelDB and Snappy are both issued under the [New BSD Licence](http://opensource.org/licenses/BSD-3-Clause).*

@@ -134,4 +134,2 @@ /* Copyright (c) 2012-2013 LevelUP contributors

if (!data) data = this.sourceData // can pass alternative data array for verification
assert.isFalse(rs.writable)
assert.isFalse(rs.readable)
assert.equals(this.endSpy.callCount, 1, 'ReadStream emitted single "end" event')

@@ -138,0 +136,0 @@ assert.equals(this.dataSpy.callCount, data.length, 'ReadStream emitted correct number of "data" events')

@@ -34,4 +34,2 @@ /* Copyright (c) 2012-2013 LevelUP contributors

this.verify = function (rs, data, done) {
assert.isFalse(rs.writable)
assert.isFalse(rs.readable)
assert.equals(this.endSpy.callCount, 1, 'Stream emitted single "end" event')

@@ -63,4 +61,2 @@ assert.equals(this.dataSpy.callCount, data.length, 'Stream emitted correct number of "data" events')

var rs = db.keyStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data', this.dataSpy)

@@ -80,4 +76,2 @@ rs.on('end', this.endSpy)

var rs = db.readStream({ keys: true, values: false })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data', this.dataSpy)

@@ -97,4 +91,2 @@ rs.on('end', this.endSpy)

var rs = db.valueStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data', this.dataSpy)

@@ -114,4 +106,2 @@ rs.on('end', this.endSpy)

var rs = db.readStream({ keys: false, values: true })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data', this.dataSpy)

@@ -118,0 +108,0 @@ rs.on('end', this.endSpy)

@@ -56,2 +56,2 @@ /* Copyright (c) 2012-2013 LevelUP contributors

}
})
})

@@ -34,4 +34,2 @@ /* Copyright (c) 2012-2013 LevelUP contributors

var rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -48,4 +46,3 @@ rs.on('end' , this.endSpy)

, pauseVerify = function () {
// NOTE: another one *will* slip through because the stream triggers an async read before triggering the event
assert.equals(calls, 6, 'stream should still be paused')
assert.equals(calls, 5, 'stream should still be paused')
rs.resume()

@@ -74,7 +71,5 @@ pauseVerify.called = true

rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)
rs.on('end' , this.endSpy)
rs.on('close', verify.bind(this))
rs.on('end', verify.bind(this))

@@ -91,11 +86,7 @@ }.bind(this))

var rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)
rs.on('end' , this.endSpy)
rs.on('close', function () {
assert.isFalse(rs.writable)
assert.isFalse(rs.readable)
assert.equals(this.dataSpy.callCount , 0, '"data" event was not fired')
assert.equals(this.endSpy.callCount , 1, '"end" event was not fired')
assert.equals(this.endSpy.callCount , 0, '"end" event was not fired')
done()

@@ -120,9 +111,5 @@ }.bind(this))

})
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)
rs.on('end' , endSpy)
rs.on('close', function () {
assert.isFalse(rs.writable)
assert.isFalse(rs.readable)
// assert.equals(this.readySpy.callCount, 1, 'ReadStream emitted single "ready" event')

@@ -155,4 +142,2 @@ // should do "data" 5 times ONLY

var rs = db.createReadStream({ reverse: true })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -173,4 +158,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: '50' })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -192,4 +175,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: '50', reverse: true })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -213,4 +194,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: '49.5' })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -232,4 +211,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: '49.5', reverse: true })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -254,4 +231,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: '499999' })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -273,4 +248,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ end: '50' })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -292,4 +265,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ end: '50.5' })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -311,4 +282,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ end: '50555555' })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -330,4 +299,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ end: '50.5', reverse: true })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -349,4 +316,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: 30, end: 70 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -368,4 +333,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: 70, end: 30, reverse: true })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -401,4 +364,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -434,4 +395,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -454,4 +413,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -461,2 +418,3 @@ rs.on('end' , this.endSpy)

}.bind(this))
rs.resume()
}.bind(this))

@@ -473,4 +431,2 @@ }.bind(this))

var rs = db.createReadStream({ start: 0 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -492,4 +448,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ end: 0 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -577,4 +531,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -604,4 +556,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ limit: 20 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -622,4 +572,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ start: '20', limit: 20 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
//rs.on('ready', this.readySpy)

@@ -641,4 +589,2 @@ rs.on('data' , this.dataSpy)

var rs = db.createReadStream({ end: '50', limit: 20 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -659,4 +605,2 @@ rs.on('end' , this.endSpy)

var rs = db.createReadStream({ end: '30', limit: 50 })
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs.on('data' , this.dataSpy)

@@ -663,0 +607,0 @@ rs.on('end' , this.endSpy)

@@ -31,11 +31,5 @@ /* Copyright (c) 2012-2013 LevelUP contributors

var rs = db.readStream()
assert.isFalse(rs.writable)
assert.isTrue(rs.readable)
rs = rs.pipe(new SlowStream({ maxWriteInterval: 5 }))
rs.on('data' , this.dataSpy)
rs.once('end' , this.endSpy)
rs.on('end', function () {
rs.readable = false
rs.writable = false
})

@@ -42,0 +36,0 @@ rs.once('close', delayed.delayed(this.verify.bind(this, rs, done), 0.05))

@@ -30,4 +30,2 @@ /* Copyright (c) 2012-2013 LevelUP contributors

if (!data) data = this.sourceData // can pass alternative data array for verification
assert.isFalse(ws.writable)
assert.isFalse(ws.readable)
async.forEach(

@@ -170,3 +168,2 @@ data

var verify = function (ws, db) {
assert.isFalse(ws.writable)
async.forEach(

@@ -191,12 +188,6 @@ this.sourceData

})
assert.isTrue(ws.writable)
assert.isFalse(ws.readable)
ws.on('close', verify.bind(this, ws, db))
this.sourceData.forEach(function (d) {
ws.write(d)
assert.isTrue(ws.writable)
assert.isFalse(ws.readable)
})
assert.isTrue(ws.writable)
assert.isFalse(ws.readable)
ws.once('ready', ws.destroy)

@@ -203,0 +194,0 @@ }.bind(this))

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