transform.destroy([error])
版本历史
| 版本 | 变更 |
|---|---|
| v14.0.0 | 在已经被销毁的流上作为空操作工作。 |
| v8.0.0 | 新增于: v8.0.0 |
销毁流,并可选择触发 'error' 事件。在此调用之后,转换流将释放所有内部资源。实现者不应覆盖此方法,而应实现 readable._destroy()。Transform 的 _destroy() 的默认实现也会触发 'close',除非 emitClose 设置为 false。
\Destroy the stream, and optionally emit an 'error' event. After this call, the
transform stream would release any internal resources.
Implementors should not override this method, but instead implement
readable._destroy().
The default implementation of _destroy() for Transform also emit 'close'
unless emitClose is set in false.
一旦调用了 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'.