levelup-defaults

2.0.0 • Public • Published

levelup-defaults

Change the defaults settings on a levelup instance by returning a new levelup instance that uses the same leveldown but different options.

npm install levelup-defaults

build status

Usage

var defaults = require('levelup-defaults')
var level = require('level')
var db = level('db')
 
// create a new levelup that uses binary encoding as default
var binaryDb = defaults(db, {valueEncoding:'binary'})
 
// create a new levelup that uses bytewise and json
var anotherDb = defaults(db, {keyEncoding:require('bytewise'), valueEncoding:'json'})

The original db is not mutated so any encoding settings on that are left unchanged.

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i levelup-defaults

Weekly Downloads

30

Version

2.0.0

License

MIT

Last publish

Collaborators

  • mafintosh