readable.destroy([error])


  • error <Error> 将作为 'error' 事件中的有效负载传递的错误
  • 返回: <this>

销毁流 可选地触发 'error' 事件,并且触发 'close' 事件(除非 emitClose 设置为 false)。 在此调用之后,可读流将释放任何内部资源,随后对 push() 的调用将被忽略。 实现者不应覆盖此方法,而应实现 readable._destroy()

  • error <Error> Error which will be passed as payload in 'error' event
  • Returns: <this>

Destroy the stream. Optionally emit an 'error' event, and emit a 'close' event (unless emitClose is set to false). After this call, the readable stream will release any internal resources and subsequent calls to push() will be ignored. Implementors should not override this method, but instead implement readable._destroy().