readable.destroy([error])
销毁流
可选地触发 'error'
事件,并且触发 'close'
事件(除非 emitClose
设置为 false
)。
在此调用之后,可读流将释放任何内部资源,随后对 push()
的调用将被忽略。
一旦 destroy()
被调用,任何进一步的调用都将是空操作,除了来自 _destroy()
的其他错误可能不会作为 'error'
触发。
实现者不应覆盖此方法,而应实现 readable._destroy()
。
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.
Once destroy()
has been called any further calls will be a no-op and no
further errors except from _destroy()
may be emitted as 'error'
.
Implementors should not override this method, but instead implement
readable._destroy()
.