How to use the level-ws.WriteStream function in level-ws

To help you get started, we’ve selected a few level-ws examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github juliangruber / level-store / index.js View on Github external
Store.prototype.createWriteStream = function (key, opts) {
  if (!opts) opts = {};

  var index = this._getIndex(opts.index, key);
  var input = through(function (chunk) {
    this.queue({
      key: index.newKey(),
      value: chunk
    });
  }).pause();
  var ws = new WriteStream(opts, this.db);

  var dpl = duplexer(input, ws);
  input.pipe(ws);

  if (typeof opts.capped != 'undefined') {
    var capped = cap(this.db, key, opts.capped);
    ws.on('end', capped.end.bind(capped));
  }

  if (opts.append) {
    if (index.initialize) index.initialize(ready);
    else ready();
  } else {
    this.reset(key, ready);
  }

level-ws

A basic writable stream for abstract-level databases

MIT
Latest version published 2 years ago

Package Health Score

56 / 100
Full package analysis

Popular level-ws functions