How to use the stream.Writable function in stream

To help you get started, we’ve selected a few stream 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 yarnpkg / yarn / test / reporters / _mock.js View on Github external
let buildStream = (key) => {
      let stream = new Writable;

      // $FlowFixMe: TODO add to flow definition
      stream.columns = 1000;

      // $FlowFixMe: TODO ditto
      stream.write = (msg) => {
        stream.emit("data", msg);
        data[key] += msg;
      };

      return stream;
    };
github yarnpkg / yarn / __tests__ / reporters / _mock.js View on Github external
const buildStream = (key): Writable => {
      const stream = new Writable();

      // $FlowFixMe: TODO add to flow definition
      stream.columns = 1000;

      // $FlowFixMe: TODO ditto
      stream.write = msg => {
        stream.emit('data', msg);
        data[key] += msg;
      };

      return stream;
    };
github yarnpkg / yarn / test / reporters / _mock.js View on Github external
let buildStream = (key) => {
      let stream = new Writable;
      stream.columns = 1000;
      stream.write = (msg) => {
        stream.emit("data", msg);
        data[key] += msg;
      };
      return stream;
    };
github juliangruber / multipipe / test / multipipe.js View on Github external
const Writable = cb => {
  const writable = new Stream.Writable({ objectMode: true })
  writable._write = (chunk, _, done) => {
    assert.strictEqual(chunk, 'A')
    done()
    cb && cb()
  }
  return writable
}
github mariuslundgard / monorepo / test / lib / prefixedStream.spec.js View on Github external
function createMockWriteStream () {
  const s = new Stream.Writable()
  s._data = ''
  s._write = function (chunk, encoding, done) {
    s._data += chunk.toString()
    done()
  }
  return s
}

stream

Node.js streams in the browser

MIT
Latest version published 4 months ago

Package Health Score

72 / 100
Full package analysis