readable.destroy([error])
-
error
<Error> 将作为'error'
事件中的有效负载传递的错误¥
error
<Error> Error which will be passed as payload in'error'
event -
返回:<this>
¥Returns: <this>
销毁流可选地触发 'error'
事件,并且触发 'close'
事件(除非 emitClose
设置为 false
)。在此调用之后,可读流将释放任何内部资源,随后对 push()
的调用将被忽略。
¥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.
一旦 destroy()
被调用,任何进一步的调用都将是空操作,除了来自 _destroy()
的其他错误可能不会作为 'error'
触发。
¥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'
.
实现者不应覆盖此方法,而应实现 readable._destroy()
。
¥Implementors should not override this method, but instead implement
readable._destroy()
.