Skip to content

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

License

Notifications You must be signed in to change notification settings

mafintosh/levelup-defaults

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

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

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages