1.1.1 • Published 11 years ago

level-stream v1.1.1

Weekly downloads
3
License
-
Repository
github
Last release
11 years ago

level-stream

Persist streams in leveldb.

Usage

var stream = require('level-stream');
var levelup = require('levelup');
var fs = require('fs');

var db = levelup('/tmp/level-stream');

fs.createReadStream(__dirname + '/file.txt')
  .pipe(stream(db, 'file'))
  .on('end', function () {
    // file.txt is stored in leveldb now
    stream(db, 'file').pipe(process.stdout);
  });

API

stream(db, key)

Returns a Duplex Stream.

If you start reading from it it replays the stream stored at key. If you write to it it persists written data at key.

stream(db)

Extend db with the db#stream so you can do

db.stream('file')

TODO

  • resuming logic: stream(db, 'file', date) should emit all data that was written since date.
  • live streams: stream.live(...) should stay open and emit new data.

Installation

With npm do

$ npm install level-stream

License

(MIT)

1.1.1

11 years ago

1.1.0

11 years ago

1.0.0

11 years ago

0.3.0

11 years ago

0.2.1

11 years ago

0.2.0

11 years ago

0.1.0

11 years ago

0.0.0

11 years ago