How to use the PassThrough function from readable-stream
Find comprehensive JavaScript readable-stream.PassThrough code examples handpicked from public code repositorys.
GitHub: implydata/plywood

6 7 8 9 10 11 12 13 14 15
var readableStream = require('readable-stream'); var Readable = readableStream.Readable; var Writable = readableStream.Writable; var Transform = readableStream.Transform; var PassThrough = readableStream.PassThrough; var immutableClass = require('immutable-class'); var generalArraysEqual = immutableClass.generalArraysEqual; var generalEqual = immutableClass.generalEqual;
238 239 240 241 242 243 244 245 246 247
### Keep stream open after it ends ```js const stream = require('readable-stream') const pts1 = new stream.PassThrough({ end: false }) const pts2 = new Stream.PassThrough() // when stream1 ends, stream2 is kept open pts1.pipe(pts2)
+ 3 other calls in file
GitHub: iarna/abraxas

13 14 15 16 17 18 19 20 21 22
this.conn = null; this.completed = false; this.inprogress = 0; var accept = new stream.PassThrough(options.accept); var transmit = new stream.PassThrough(options.transmit); if (! options.encoding) options.encoding = this.options.defaultEncoding; if (options.encoding == 'buffer') delete options.encoding; if (options.encoding && (!options.accept || !options.accept.encoding)) {
+ 31 other calls in file
GitHub: iarna/abraxas

48 49 50 51 52 53 54 55 56 57
? this._sendBufferToChild(child) : child.drain = child.dest.once('drain',function() { self._sendBufferToChild(child) }); } StreamReplay.prototype.spawn = function () { var out = new stream.PassThrough(); this.pipe(out); var self = this; out.once('end',function(){ self.unpipe(out) }); return out;
GitHub: marionebl/bankai

22 23 24 25 26 27 28 29 30 31
} // either css hasn't been updated, and is ready to serve // or attach a listener to when css will be updated // and send when ready if (!state.cssReady) { const ts = new stream.PassThrough() state.once('css:ready', function () { state.cssBuf.duplicate().pipe(ts) }) return ts
GitHub: nodejs-spain/webtorrent

63 64 65 66 67 68 69 70 71 72
this._torrent.deselect(this._startPiece, this._endPiece, false) } createReadStream (opts) { if (this.length === 0) { const empty = new PassThrough() process.nextTick(() => { empty.end() }) return empty
GitHub: YuchenWell/exceljs

2 3 4 5 6 7 8 9 10 11
module.exports = async function*(iterable) { // TODO: Remove once node v8 is deprecated // Detect and upgrade old streams if (iterable.pipe && !iterable[Symbol.asyncIterator]) { iterable = iterable.pipe(new PassThrough()); } const saxesParser = new SaxesParser(); let error; saxesParser.on('error', err => {
139 140 141 142 143 144 145 146 147 148
for (const {sheetNo, path, tempFileCleanupCallback} of waitingWorkSheets) { let fileStream = fs.createReadStream(path); // TODO: Remove once node v8 is deprecated // Detect and upgrade old fileStreams if (!fileStream[Symbol.asyncIterator]) { fileStream = fileStream.pipe(new PassThrough()); } yield* this._parseWorksheet(fileStream, sheetNo); tempFileCleanupCallback(); }
readable-stream.call is the most popular function in readable-stream (1227 examples)