Awesome
level-iterator
*Decoding iterator for levelup instances. Wraps DOWN iterators like level-iterator-stream
does. For when you want speed and can do without backpressure and other stream features.
example
const iterator = require('level-iterator')
const disk = require('test-level')({ clean: true, encoding: 'json' })
const db = disk()
db.batch([
{ key: 1, value: 1 },
{ key: 2, value: 2 },
{ key: 3, value: 3 }
], function(err) {
// Bypass value decoding
const iter = iterator(db, { gt: 2, values: false })
iter.next(function(err, key, value){
console.log(typeof key, key === 3, value) // number true null
// Don't forget to call end()
iter.end(function(){
console.log('done')
})
})
})
iterator(db[,opts])
db
must be a levelup dbopts
is all the usual stuff (keys, values, limit, ltgt, encoding, ..)
install
With npm do:
npm install level-iterator
license
MIT © Vincent Weevers