How to use the on function from readable-stream

Find comprehensive JavaScript readable-stream.on code examples handpicked from public code repositorys.

3110
3111
3112
3113
3114
3115
3116
3117
3118
3119
    }
};
stream.text = () => new Promise((resolve, reject) => {
    let body = '';
    stream.setEncoding('utf8');
    stream.on('data', chunk => body += chunk);
    stream.on('end', () => resolve(body));
    stream.on('error', reject);
});
process.nextTick(doDownload);
fork icon2
star icon3
watch icon1

+ 16 other calls in file

5466
5467
5468
5469
5470
5471
5472
5473
5474
5475
// This is *not* part of the readable stream interface.
// It is an ugly unfortunate mess of history.
Readable.prototype.wrap = function (stream) {
  var state = this._readableState;
  var paused = false;
  stream.on('end', () => {
    debug('wrapped end');
    if (state.decoder && !state.ended) {
      var chunk = state.decoder.end();
      if (chunk && chunk.length) this.push(chunk);
fork icon0
star icon0
watch icon1

+ 83 other calls in file