@@ -499,6 +499,15 @@ write('hello', () => {
499
499
500
500
A Writable stream in object mode will always ignore the ` encoding ` argument.
501
501
502
+ ##### writable.destroy([ error] )
503
+ <!-- YAML
504
+ added: REPLACEME
505
+ -->
506
+
507
+ Destroy the stream, and emit the passed error. After this call, the
508
+ writible stream has ended. Implementors should not override this method,
509
+ but instead implement [ ` writable._destroy ` ] [ writable-_destroy ] .
510
+
502
511
### Readable Streams
503
512
504
513
Readable streams are an abstraction for a * source* from which data is
@@ -1070,6 +1079,16 @@ myReader.on('readable', () => {
1070
1079
});
1071
1080
```
1072
1081
1082
+ ##### readable.destroy([ error] )
1083
+ <!-- YAML
1084
+ added: REPLACEME
1085
+ -->
1086
+
1087
+ Destroy the stream, and emit ` 'error' ` . After this call, the
1088
+ readable stream will release any internal resources.
1089
+ Implementors should not override this method, but instead implement
1090
+ [ ` readable._destroy ` ] [ readable-_destroy ] .
1091
+
1073
1092
### Duplex and Transform Streams
1074
1093
1075
1094
#### Class: stream.Duplex
@@ -1109,6 +1128,16 @@ Examples of Transform streams include:
1109
1128
* [ zlib streams] [ zlib ]
1110
1129
* [ crypto streams] [ crypto ]
1111
1130
1131
+ ##### transform.destroy([ error] )
1132
+ <!-- YAML
1133
+ added: REPLACEME
1134
+ -->
1135
+
1136
+ Destroy the stream, and emit ` 'error' ` . After this call, the
1137
+ transform stream would release any internal resources.
1138
+ implementors should not override this method, but instead implement
1139
+ [ ` readable._destroy ` ] [ readable-_destroy ] .
1140
+ The default implementation of ` _destroy ` for ` Transform ` also emit ` 'close' ` .
1112
1141
1113
1142
## API for Stream Implementers
1114
1143
@@ -1248,6 +1277,8 @@ constructor and implement the `writable._write()` method. The
1248
1277
[ ` stream._write() ` ] [ stream-_write ] method.
1249
1278
* ` writev ` {Function} Implementation for the
1250
1279
[ ` stream._writev() ` ] [ stream-_writev ] method.
1280
+ * ` destroy ` {Function} Implementation for the
1281
+ [ ` stream._destroy() ` ] [ writable-_destroy ] method.
1251
1282
1252
1283
For example:
1253
1284
@@ -1358,6 +1389,15 @@ The `writable._writev()` method is prefixed with an underscore because it is
1358
1389
internal to the class that defines it, and should never be called directly by
1359
1390
user programs.
1360
1391
1392
+ #### writable.\_ destroy(err, callback)
1393
+ <!-- YAML
1394
+ added: REPLACEME
1395
+ -->
1396
+
1397
+ * ` err ` {Error} An error.
1398
+ * ` callback ` {Function} A callback function that takes an optional error argument
1399
+ which is invoked when the writable is destroyed.
1400
+
1361
1401
#### Errors While Writing
1362
1402
1363
1403
It is recommended that errors occurring during the processing of the
@@ -1428,6 +1468,8 @@ constructor and implement the `readable._read()` method.
1428
1468
a single value instead of a Buffer of size n. Defaults to ` false `
1429
1469
* ` read ` {Function} Implementation for the [ ` stream._read() ` ] [ stream-_read ]
1430
1470
method.
1471
+ * ` destroy ` {Function} Implementation for the [ ` stream._destroy() ` ] [ readable-_destroy ]
1472
+ method.
1431
1473
1432
1474
For example:
1433
1475
@@ -2079,4 +2121,8 @@ readable buffer so there is nothing for a user to consume.
2079
2121
[ stream-read ] : #stream_readable_read_size
2080
2122
[ stream-resume ] : #stream_readable_resume
2081
2123
[ stream-write ] : #stream_writable_write_chunk_encoding_callback
2082
- [ zlib ] : zlib.html
2124
+ [ readable-_destroy ] : #stream_readable_destroy_err_callback
2125
+ [ writable-_destroy ] : #stream_writable_destroy_err_callback
2126
+ [ TCP sockets ] : net.html#net_class_net_socket
2127
+ [ Transform ] : #stream_class_stream_transform
2128
+ [ Writable ] : #stream_class_stream_writable
0 commit comments