How to use level-ws - 2 common examples

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 polkadot-js / common / packages / trie-db-old / src / CheckpointTrie.ts View on Github external
return new Promise((resolve) => {
          if (!db.createWriteStream) {
            db = levelws(db);
          }

          this
            // @ts-ignore FIXME, we need to properly check the full file
            .createScratchReadStream(scratch)
            // @ts-ignore FIXME, we need to properly check the full file
            .pipe(
              // @ts-ignore FIXME, we need to properly check the full file
              db.createWriteStream(encoder.options)
            )
            .on('close', resolve);
        });
      })
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