Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

level-blobs

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

level-blobs

Save binary blobs in level and stream then back

  • 0.1.6
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
137K
decreased by-9.65%
Maintainers
1
Weekly downloads
 
Created
Source

level-blobs

Save binary blobs in level and stream then back. Similar to level-store but streams2 and with support for random access writes and reads

npm install level-blobs

build status

browser support

Usage

var blobs = require('level-blobs');
var level = require('level');

var db = level('/tmp/my-blobs-db');
var bl = blobs(db);

// create a write stream
var ws = blobs.createWriteStream('my-file.txt');

ws.on('finish', function() {
	// lets read the blob and pipe it to stdout
	var rs = blobs.createReadStream('my-file.txt');
	rs.pipe(process.stdout);
});

ws.write('hello ');
ws.write('world');
ws.end();

API

blobs(db, opts)

Create a new blobs instance. Options default to

{
	blockSize: 65536, // byte size for each block of data stored
	batch: 100        // batch at max 100 blocks when writing
}
bl.createReadStream(name, opts)

Create a read stream for name. Options default to

{
	start: 0       // start reading from this byte offset
	end: Infinity  // end at end-of-file or this offset (inclusive)
}
bl.createWriteStream(name, opts)

Create a write stream to name. Options default to

{
	start: 0       // start writing at this offset
	               // if append === true start defaults to end-of-file
	append: false  // set to true if you want to append to the file
	               // if not true the file will be truncated before writing
}
bl.read(name, opts, cb)

Create a read stream and buffer the stream into a single buffer that is passed to the callback. Options are passed to createReadStream.

bl.write(name, data, opts, cb)

Write data to name and call the callback when done. Options are passed to createWriteStream.

bl.remove(name, cb)

Remove name from the blob store

License

MIT

Keywords

FAQs

Package last updated on 13 Apr 2014

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc