Socket
Socket
Sign inDemoInstall

abstract-stream-leveldown

Package Overview
Dependencies
4
Maintainers
2
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    abstract-stream-leveldown

A stream-based abstract prototype matching the LevelDOWN API


Version published
Maintainers
2
Install size
164 kB
Created

Readme

Source

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(AbstractStreamLevelDOWN, {
  _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.

Keywords

FAQs

Last updated on 11 Sep 2015

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc