lu

2.0.0 • Public • Published

lu

Simplest tool for reading a leveldb

all the code

optimist + levelup

If you want features, use lev

#! /usr/bin/env node
var opts     = require('rc')('lq', {encoding: 'json'})
var levelup  = require('levelup')
var sublevel = require('level-sublevel')
var path     = require('path')
 
var db = sublevel(levelup(path.resolve(opts._[0] || '.'), opts))
 
if(opts.max)
  opts.max = opts.max.split('\\xff').join('\xff')
if(opts.min)
  opts.min = opts.min.split('\\xff').join('\xff')
if(opts.pre)
  opts.pre = opts.pre.split('\\xff').join('\xff')
 
if(opts.pre) {
  opts.min = opts.pre
  opts.max = opts.pre + '\xff'
}
 
if(opts.all) { //read
  opts.min = '',
  opts.max = '\xff\xff\xff'
}
 
db.createReadStream({
  min: opts.min,
  max: opts.max,
  reverse: opts.reverse
})
.on('data', console.log)

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i lu

Weekly Downloads

4

Version

2.0.0

License

MIT

Last publish

Collaborators

  • nopersonsmodules