@@ -499,6 +499,15 @@ write('hello', () => {
499499
500500A Writable stream in object mode will always ignore the ` encoding `  argument.
501501
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+ 
502511### Readable Streams  
503512
504513Readable streams are an abstraction for a * source*  from which data is
@@ -1070,6 +1079,16 @@ myReader.on('readable', () => {
10701079});
10711080``` 
10721081
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+ 
10731092### Duplex and Transform Streams  
10741093
10751094#### Class: stream.Duplex  
@@ -1109,6 +1128,16 @@ Examples of Transform streams include:
11091128*  [ zlib streams] [ zlib ] 
11101129*  [ crypto streams] [ crypto ] 
11111130
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' ` .
11121141
11131142## API for Stream Implementers  
11141143
@@ -1248,6 +1277,8 @@ constructor and implement the `writable._write()` method. The
12481277    [ ` stream._write() ` ] [ stream-_write ]  method.
12491278  *  ` writev `  {Function} Implementation for the
12501279    [ ` stream._writev() ` ] [ stream-_writev ]  method.
1280+   *  ` destroy `  {Function} Implementation for the
1281+     [ ` stream._destroy() ` ] [ writable-_destroy ]  method.
12511282
12521283For example:
12531284
@@ -1358,6 +1389,15 @@ The `writable._writev()` method is prefixed with an underscore because it is
13581389internal to the class that defines it, and should never be called directly by
13591390user programs.
13601391
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+ 
13611401#### Errors While Writing  
13621402
13631403It is recommended that errors occurring during the processing of the
@@ -1428,6 +1468,8 @@ constructor and implement the `readable._read()` method.
14281468    a single value instead of a Buffer of size n. Defaults to ` false ` 
14291469  *  ` read `  {Function} Implementation for the [ ` stream._read() ` ] [ stream-_read ] 
14301470    method.
1471+   *  ` destroy `  {Function} Implementation for the [ ` stream._destroy() ` ] [ readable-_destroy ] 
1472+     method.
14311473
14321474For example:
14331475
@@ -2079,4 +2121,8 @@ readable buffer so there is nothing for a user to consume.
20792121[ stream-read ] : #stream_readable_read_size 
20802122[ stream-resume ] : #stream_readable_resume 
20812123[ 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