GithubHelp home page GithubHelp logo

abstract-stream-leveldown's Introduction

abstract-stream-leveldown

This library provides a smaller API footprint for using AbstractLevelDOWN to create a LevelDOWN backend, by implementing a Readable and Writable stream instead of all of the abstract LevelDOWN methods. It's a good fit for turning something that already has readable and writable stream interfaces into a LevelDOWN backend.

Example

in es6

import {AbstractStreamLevelDOWN} from "abstract-stream-leveldown"

class MyLevelDOWN extends AbstractStreamLevelDOWN {
   _createReadStream([options]) { /* return a Readable */ }
   _createWriteStream([options]) { /* return a Writable */ }
}

in es5

var inherits = require('inherits')
var assign = require('object-assign')
var AbstractStreamLevelDOWN = require('abstract-stream-leveldown').AbstractStreamLevelDOWN

function MyLevelDOWN (location) {
  AbstractLevelDOWN.call(this, location)
}
inherits(MyLevelDOWN, AbstractStreamLevelDOWN)
assign(MyLevelDOWN.prototype, {
  _createReadStream([options]) { /* return a Readable */ }
  _createWriteStream([options]) { /* return a Writable */ }
}

API

AbstractStreamLevelDOWN#_createReadStream([options])

Returns a Readable stream. options should support the same properties as those to be passed to createReadStream.

AbstractStreamLevelDOWN#_createWriteStream([options])

Returns a Writable stream. options should support the same properties as those to be passed to put. This stream accepts {key, value} objects, and will perform a del if the value is null or undefined, and a put otherwise.

abstract-stream-leveldown's People

Contributors

ahdinosaur avatar jcrugzz avatar jed avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

Forkers

holodex jcrugzz

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.