Skip to content

leveldb with backend + optional repl built with subleveldown and multileveldown.

License

Notifications You must be signed in to change notification settings

JamesKyburz/leveldb-mount

Repository files navigation

leveldb-mount

leveldb with backend + optional repl built with subleveldown and multileveldown.

js-standard-style Greenkeeper badge

server

server.js

var leveldb = require('leveldb-mount')
leveldb.server(httpServer, opt) // see options

server+repl

var leveldb = require('leveldb-mount')
leveldb.server(port, opt) // see options

Note if no credentials are given the repl is not available.

client

browserifying this module gives you a client

see examples

routes

routes.js using http-hash (but can use router of choice)

var leveldb = require('leveldb-mount')
var routes = leveldb.routes(opt) // see options
router.set('/repl.html', routes.html)
router.set('/repl.js', routes.js)

db

var db = leveldb.db(opt) // see options
var inbox = db.namespace('inbox')
inbox.set...
db.set...

optional repl

navigation to /repl.html and window.db and window.sublevel will now be set.

options

var opt = {
  dbPath: 'path',
  replCredentials: 'user:pass',
  encoding: {
    keyEncoding: 'utf8',
    valueEncoding: 'json'
  }
}
  • opt.replCredentials is only needed if you want the repl.
  • opt.encoding defaults to utf8 for keys and json for values.
  • opt.dbPath has to contain a value.
  • opt.auth optional auth function (request, cb).

encoding is passed to the repl!

example

npm install concat-stream
node example/index.js

About

leveldb with backend + optional repl built with subleveldown and multileveldown.

Resources

License

Stars

Watchers

Forks

Packages

No packages published