virtualdown
Wrap a leveldown module as a virtual database
Last updated 5 years ago by finnpauls .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install virtualdown 
SYNC missed versions from official npm registry.

virtualdown

Windows Mac/Linux
Windows Build status Build Status

Wraps a leveldown-compatible module as such as no changes are made on the original database instance. Instead it writes all put/del to memory. When performing get it first checks the memory and only fetched from the original source if it's not in memory. This means when using virtualdown it looks like the original database is changed, but in reality nothing is.

Install with npm install virtualdown

You can get your leveldown drop-in by wrapping it around another leveldown module:

var myVirtualDown = require('virtualdown')(somethingDOWN)

It is a generalisation of the virtual-leveldown module.

example

var virtualDown = require('virtualdown')
var leveldown = require('leveldown')

var virtualLevelDown = virtualDOWN(leveldown)

var db = virtualLevelDown('mydatabase') // filled with cats

db.open(function () {
    db.put('doggy', 'dogdog', function (err) {
      db.get('doggy', function (value) {
        // value == 'dogdog'
        // but the dog is not in 'mydatabase' on disk
      })
    })
})

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

1 Versions

  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 2
Dependencies (3)
Dev Dependencies (2)
Dependents (1)

Copyright 2014 - 2017 © taobao.org |