Socket
Book a DemoInstallSign in
Socket

level-manifest

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-manifest

describe a levelup plugin for remote access

latest
Source
npmnpm
Version
1.2.0
Version published
Maintainers
1
Created
Source

level-manifest

Describe the functions that multilevel should provide access to on the client.

Build Status

Example

Suppose you implement a levelup plugin that adds some cool new features to a sublevel

retrive a js object describing what methods a client protocol should be able to access.

var manifest = require('level-manifest')

var m = manifest(db)

manifest build a tree of sublevels.

{
  methods:   {},
  sublevels: {
    foo: {
      methods: {},
      sublevels: {}
    }
  }
}

Plugins extending a sublevel should add a methods property that describes any new methods that can be used by a remote client.

for example, the default methods are specified like this:

var methods = {
  createReadStream  : {type: 'readable'},
  readStream        : {type: 'readable'},
  createValueStream : {type: 'readable'},
  valueStream       : {type: 'readable'},
  createKeyStream   : {type: 'readable'},
  keyStream         : {type: 'readable'},
  createWriteStream : {type: 'writable'},
  writeStream       : {type: 'writable'},
  isOpen            : {type: 'sync'},
  isClosed          : {type: 'sync'},
  put               : {type: 'async'},
  get               : {type: 'async'},
  del               : {type: 'async'},
  batch             : {type: 'async'},
  approximateSize   : {type: 'async'}
}

readable, and writable mean readable or writable streams, (use duplex for a stream that is both readable and writable.)

A client should also provide support for these types:

var other = {
  error        : {type: 'error', message: 'not-supported'},
  createStream : {type: 'duplex'},
  nested       : {type: 'object', methods: {get: {type: 'async'}}}
}

error is used when a method has been disabled.

License

MIT

FAQs

Package last updated on 25 Nov 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts