level-dump
Dumps all values and/or keys of a level db or a sublevel to the console.
Last updated 3 years ago by thlorenz .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install level-dump 
SYNC missed versions from official npm registry.

level-dump build status

Dumps all values and/or keys of a level db or a sublevel to the console.

Intended for debugging purposes in order to just show and/or count db entries.

var dump = require('level-dump');
dump(db);         // dump keys and values (same as dump.entries)
dump.keys(db);    // dump keys only
dump.values(db);  // dump values only

dump.allKeys(db);     // dump keys including all sublevels
dump.allValues(db);   // dump values including all sublevels
dump.allEntries(db);  // dump entries including all sublevels

db to be any level-up instance, including a sublevel, in which cases it only dumps value inside the sublevel.

Override dump location

By default the dump gets written via console.log. You can overwrite this however.

This comes in useful for testing for instance:

var assert = require('assert');
var dump = require('level-dump');

dump(
    db 
  , function write(data) {
      assert.deepEqual(data, 'what I expected'); 
    }
  , function end(err) {
      assert.notOk(err);
    }
  )

API

dump(db[, write, end])

dump.{entries,keys,values}(db[, write, end])

  • db the leveldb instance, whose entries to dump
  • write : function called for every dumped value (default: console.log)
  • end: function called when all values have been dumped and/or an error occurred

Note: when write is supplied, end needs to be as well. When only one function is supplied it will be treated as end.

dump.{allEntries,allKeys,allValues}(db[, write, end])

  • same as above except if called on the root level db, it will include keys/values/entries of all sublevels

Command line

Install

npm install -g level-dump

Usage

# print usage:
level-dump -h

Current Tags

  • 1.1.0                                ...           latest (3 years ago)

7 Versions

  • 1.1.0                                ...           3 years ago
  • 1.0.0                                ...           6 years ago
  • 0.4.0                                ...           7 years ago
  • 0.3.1                                ...           7 years ago
  • 0.3.0                                ...           7 years ago
  • 0.2.0                                ...           7 years ago
  • 0.1.0                                ...           7 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (2)
Dev Dependencies (4)
Dependents (1)

Copyright 2014 - 2016 © taobao.org |