@@ -421,6 +421,10 @@ This is a destructive and immediate way to destroy a stream. Previous calls to
421
421
Use ` end() ` instead of destroy if data should flush before close, or wait for
422
422
the ` 'drain' ` event before destroying the stream.
423
423
424
+ If ` .destroy() ` is called without an ` error ` and ` autoDestroy ` is
425
+ enabled, then if the stream has not completed it will be
426
+ automatically destroyed with an ` AbortError ` .
427
+
424
428
``` cjs
425
429
const { Writable } = require (' stream' );
426
430
@@ -1101,6 +1105,10 @@ further errors except from `_destroy()` may be emitted as `'error'`.
1101
1105
Implementors should not override this method, but instead implement
1102
1106
[ ` readable._destroy() ` ] [ readable-_destroy ] .
1103
1107
1108
+ If ` .destroy() ` is called without an ` error ` and ` autoDestroy ` is
1109
+ enabled, then if the stream has not completed it will be
1110
+ automatically destroyed with an ` AbortError ` .
1111
+
1104
1112
##### ` readable.closed `
1105
1113
1106
1114
<!-- YAML
@@ -1805,6 +1813,10 @@ unless `emitClose` is set in false.
1805
1813
Once ` destroy() ` has been called, any further calls will be a no-op and no
1806
1814
further errors except from ` _destroy() ` may be emitted as ` 'error' ` .
1807
1815
1816
+ If ` .destroy() ` is called without an ` error ` and ` autoDestroy ` is
1817
+ enabled, then if the stream has not completed it will be
1818
+ automatically destroyed with an ` AbortError ` .
1819
+
1808
1820
### ` stream.finished(stream[, options], callback) `
1809
1821
1810
1822
<!-- YAML
@@ -2508,6 +2520,8 @@ changes:
2508
2520
[ ` stream._construct() ` ] [ writable-_construct ] method.
2509
2521
* ` autoDestroy ` {boolean} Whether this stream should automatically call
2510
2522
` .destroy() ` on itself after ending. ** Default:** ` true ` .
2523
+ * ` autoAbort ` {boolean} Whether this stream should automatically
2524
+ error if ` .destroy() ` is called without an error before the stream has emitted ` 'finish' ` .
2511
2525
* ` signal ` {AbortSignal} A signal representing possible cancellation.
2512
2526
2513
2527
<!-- eslint-disable no-useless-constructor -->
@@ -2865,6 +2879,8 @@ changes:
2865
2879
[ ` stream._construct() ` ] [ readable-_construct ] method.
2866
2880
* ` autoDestroy ` {boolean} Whether this stream should automatically call
2867
2881
` .destroy() ` on itself after ending. ** Default:** ` true ` .
2882
+ * ` autoAbort ` {boolean} Whether this stream should automatically
2883
+ error if ` .destroy() ` is called without an error before the stream has emitted ` 'end' ` .
2868
2884
* ` signal ` {AbortSignal} A signal representing possible cancellation.
2869
2885
2870
2886
<!-- eslint-disable no-useless-constructor -->
0 commit comments