How to use the readable-stream.Transform.call function in readable-stream

To help you get started, we’ve selected a few readable-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 watson-developer-cloud / speech-javascript-sdk / speech-to-text / timing-stream.js View on Github external
function TimingStream(opts) {
  this.options = defaults(opts, {
    emitAt: TimingStream.END,
    delay: 0,
    allowHalfOpen: true, // keep the readable side open after the source closes
    writableObjectMode: true
  });
  Transform.call(this, opts);

  this.startTime = Date.now();

  // to support stopping mid-stream
  this.stopped = false;
  this.timeout = null;
}
util.inherits(TimingStream, Transform);
github stdlib-js / stdlib / lib / node_modules / @stdlib / streams / node / split / lib / main.js View on Github external
opts = copy( DEFAULTS );
	if ( arguments.length ) {
		err = validate( opts, options );
		if ( err ) {
			throw err;
		}
	}
	// The stream's readable state should always be in object mode to prevent split data from being buffered (concatenated) and no longer being separated...
	opts.readableObjectMode = true;

	// The stream converts each chunk into a string so no need to encode strings written to the split stream as Buffer objects:
	opts.decodeStrings = false;

	// Make the stream a Transform stream:
	debug( 'Creating a transform stream configured with the following options: %s.', JSON.stringify( opts ) );
	Transform.call( this, opts );

	// Cache the separator:
	setNonEnumerableReadOnly( this, '_sep', ( opts.sep === null ) ? RE : opts.sep );

	// The destruction state:
	setNonEnumerable( this, '_destroyed', false );

	// Cache the encoding:
	setNonEnumerableReadOnly( this, '_encoding', opts.encoding );

	// Buffer for storing partial splits:
	setNonEnumerable( this, '_buffer', '' );

	// Chunk counter:
	setNonEnumerable( this, '_idx', -1 );
github w3c / midgard / node_modules / browserify / node_modules / module-deps / index.js View on Github external
function Deps (opts) {
    var self = this;
    if (!(this instanceof Deps)) return new Deps(opts);
    Transform.call(this, { objectMode: true });
    
    if (!opts) opts = {};
    
    this.basedir = opts.basedir || process.cwd();
    this.cache = opts.cache;
    this.fileCache = opts.fileCache;
    this.pkgCache = opts.packageCache || {};
    this.pkgFileCache = {};
    this.pkgFileCachePending = {};
    this._emittedPkg = {};
    this.visited = {};
    this.walking = {};
    this.entries = [];
    this._input = [];
    
    this.paths = opts.paths || process.env.NODE_PATH || '';
github levelgraph / levelgraph / lib / filterstream.js View on Github external
function FilterStream(options) {
  if (!(this instanceof FilterStream)) {
    return new FilterStream(options);
  }

  options.objectMode = true;

  Transform.call(this, options);

  var that = this;

  this.filter = options.filter;
  this.offset = options.offset;

  this._offsetCounter = 0;

  this._destroyed = false;

  if (this.filter && this.filter.length === 2) {
    this._transform = filterTwoArguments;
  }
}
github myter / Spiders.js / node_modules / browserify / node_modules / module-deps / index.js View on Github external
function Deps (opts) {
    var self = this;
    if (!(this instanceof Deps)) return new Deps(opts);
    Transform.call(this, { objectMode: true });
    
    if (!opts) opts = {};
    
    this.basedir = opts.basedir || process.cwd();
    this.persistentCache = opts.persistentCache || function (file, id, pkg, fallback, cb) {
        process.nextTick(function () {
            fallback(null, cb);
        });
    };
    this.cache = opts.cache;
    this.fileCache = opts.fileCache;
    this.pkgCache = opts.packageCache || {};
    this.pkgFileCache = {};
    this.pkgFileCachePending = {};
    this._emittedPkg = {};
    this.visited = {};
github ninabreznik / voting-ethereum-contract / node_modules / module-deps / index.js View on Github external
function Deps (opts) {
    var self = this;
    if (!(this instanceof Deps)) return new Deps(opts);
    Transform.call(this, { objectMode: true });
    
    if (!opts) opts = {};
    
    this.basedir = opts.basedir || process.cwd();
    this.persistentCache = opts.persistentCache || function (file, id, pkg, fallback, cb) {
        process.nextTick(function () {
            fallback(null, cb);
        });
    };
    this.cache = opts.cache;
    this.fileCache = opts.fileCache;
    this.pkgCache = opts.packageCache || {};
    this.pkgFileCache = {};
    this.pkgFileCachePending = {};
    this._emittedPkg = {};
    this._transformDeps = {};
github archiverjs / node-archiver / lib / plugins / json.js View on Github external
var Json = function(options) {
  if (!(this instanceof Json)) {
    return new Json(options);
  }

  options = this.options = util.defaults(options, {});

  Transform.call(this, options);

  this.supports = {
    directory: true,
    symlink: true
  };

  this.files = [];
};
github GraftJS / jschan / lib / channels.js View on Github external
function Channel(session, id) {
  Transform.call(this, { objectMode: true, highWaterMark: 16 });

  this._session = session;
  this.id = id;
}
github apache / cordova-firefoxos / node_modules / node-firefox-install-app / node_modules / zip-folder / node_modules / archiver / lib / modules / core / index.js View on Github external
var Archiver = module.exports = function(options) {
  options = this.options = util.defaults(options, {
    highWaterMark: 1024 * 1024
  });

  Transform.call(this, options);

  this._entries = [];
  this._module = false;
  this._pointer = 0;

  this._queue = async.queue(this._onQueueTask.bind(this), 1);
  this._queue.drain = this._onQueueDrain.bind(this);

  this._state = {
    finalize: false,
    finalized: false,
    modulePiped: false
  };
};