How to use the stream.Transform 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 chjj / blessed / browser / transform.js View on Github external
function transformer(code) {
  var stream = new Transform;
  stream._transform = function(chunk, encoding, callback) {
    return callback(null, chunk);
  };
  stream._flush = function(callback) {
    if (code) {
      stream.push(code);
    }
    return callback();
  };
  return stream;
}
github NCBI-Hackathons / deSRA / web / app / node_modules / acorn / bin / build-acorn.js View on Github external
function acornShimComplete() {
  var tr = new stream.Transform
  var buffer = "";
  tr._transform = function(chunk, _, callback) {
    buffer += chunk.toString("utf8");
    callback();
  };
  tr._flush = function (callback) {
    tr.push(buffer.replace(ACORN_PLACEHOLDER, "module.exports = typeof acorn != 'undefined' ? acorn : require(\"./acorn\")"));
    callback(null);
  };
  return tr;
}
github acornjs / acorn / bin / build-acorn.js View on Github external
function acornShimComplete() {
  var tr = new stream.Transform
  var buffer = "";
  tr._transform = function(chunk, _, callback) {
    buffer += chunk.toString("utf8");
    callback();
  };
  tr._flush = function (callback) {
    tr.push(buffer.replace(ACORN_PLACEHOLDER, "module.exports = typeof acorn != 'undefined' ? acorn : require(\"./acorn\")"));
    callback(null);
  };
  return tr;
}
github zemirco / json2csv / lib / JSON2CSVAsyncParser.js View on Github external
constructor(opts, transformOpts) {
    this.input = new Transform(transformOpts);
    this.input._read = () => {};

    this.transform = new JSON2CSVTransform(opts, transformOpts);
    this.processor = this.input.pipe(this.transform);
  }
github gdh1995 / vimium-c / Gulpfile.js View on Github external
function gulpMap(map) {
  var Transform = require('stream').Transform;
  var transformer = new Transform({objectMode: true});
  transformer._transform = function(srcFile, encoding, done) {
    var dest = map(srcFile);
    this.push(dest || srcFile);
    done();
  };
  transformer._flush = function(done) { done(); };
  return transformer;
}

stream

Node.js streams in the browser

MIT
Latest version published 4 months ago

Package Health Score

72 / 100
Full package analysis