8000 GitHub - pcan/leveldb-viewer: A simple, minimalistic, web-based LevelDB viewer for Node.js
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

pcan/leveldb-viewer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

leveldb-viewer

A simple, minimalistic, web-based LevelDB viewer for Node.js.

Usage

Install the module with npm i --save @pcan/leveldb-viewer. The following snippet shows the sample usage:

const { createViewerServer } = require('@pcan/leveldb-viewer');
const leveldown = require('leveldown');
const levelup = require('levelup');
const encode = require('encoding-down');
const db = levelup(encode(leveldown('/path/to/db'), { keyEncoding: 'buffer', valueEncoding: 'json' })); 
const server = createViewerServer(db); // This returns a Node.JS HttpServer.
server.<
619A
/span>listen(9090); // you may invoke listen...
server.close() // ...and close.

Once you started the server with server.listen(9090) open the browser at http://localhost:9090. You should be able to explore the contents of your LevelDB instance using a tree view. The webpage uses a minimal API to retrieve data:

  • GET /api/query retrieves the keys (or their common prefixes) using root param to specify the desired prefix and limit to limit the number of records. The response returns an array of objects having this format: {val: string, count: number}. The val field is the prefix (or the whole key) and count is the number of records having that prefix.
  • GET /api/value retrieves the value (as JSON object) having the specified key param.

About

A simple, minimalistic, web-based LevelDB viewer for Node.js

Resources

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  
0