readable.resume()


readable.resume() 方法使被显式暂停的 Readable 流恢复触发 'data' 事件,将流切换到流动模式。

readable.resume() 方法可用于完全地消费流中的数据,而无需实际处理任何数据:

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

如果有 '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.