level-peek

2.0.2 • Public • Published

level-peek

peek the first or last record in a leveldb range.

example

var levelup = require('levelup')
var db = levelup(PATH_TO_DB)
 
var peek = require('level-peek')
 
//get the first value, 'a' or after
peek.first(db, {start: 'a'}, function (err, key, value) {
  console.log(key, value)
})
 
//get last value, 'z' or before.
peek.last(db, {end: 'z'}, function (err, key, value) {
  console.log(key, value)
})

see also, level-fix-range and https://github.com/rvagg/node-levelup/issues/110

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i level-peek

Weekly Downloads

121,424

Version

2.0.2

License

MIT

Last publish

Collaborators

  • nopersonsmodules