level-fsdown

use the file system as a backing store for levelup

Downloads in past

Stats

StarsIssuesVersionUpdatedCreatedSize
level-fsdown
913.2.38 years ago8 years agoMinified + gzip package size for level-fsdown in KB

Readme

SYNOPSIS
A levelup0 compatible abstraction1 for node's fs2 module to use the file system as a backing store.
BUILDS/TESTS
Build Status
USAGE
const Fsdown = require('level-fsdown')

let db = levelup(__dirname, {
  db: Fsdown,
  valueEncoding: 'json'
})


db.put(['foo', 'bar'], { hello: 'world' }, (err) => {
  if (err) throw err

  // a file containing the json `{ hello: 'world' }` was
  // written to the location `<__dirname>/foo/bar.json`.

  db.get(['foo', 'bar'], (err, value) => {
    if (err) throw err
    console.log(value)
  })
})

When keys are provided as arrays, they are joined with the appropriate path.sep and then prefixed with the location as specified by the constructor.
Supports get, put, del, batch and createReadStream methods.