readable.resume()


将被暂停的可读流恢复触发 'data' 事件,并将流切换到流动模式。

readable.resume() 可以用来充分消耗流中的数据,但无需实际处理任何数据:

getReadableStreamSomehow()
  .resume()
  .on('end', () => {
    console.log('到达流的尽头,但无需读取任何数据');
  });

当存在 'readable' 事件监听器时,readable.resume() 不起作用。

The readable.resume() method causes an explicitly paused Readable stream to resume emitting 'data' events, switching the stream into flowing mode.

The readable.resume() method can be used to fully consume the data from a stream without actually processing any of that data:

getReadableStreamSomehow()
  .resume()
  .on('end', () => {
    console.log('Reached the end, but did not read anything.');
  });

The readable.resume() method has no effect if there is a 'readable' event listener.