@@ -1375,6 +1375,10 @@ Examples:
13751375var readable = new stream.Readable ({
13761376 read : function (n ) {
13771377 // sets this._read under the hood
1378+
1379+ // push data onto the read queue, passing null
1380+ // will signal the end of the stream (EOF)
1381+ this .push (chunk);
13781382 }
13791383});
13801384```
@@ -1384,6 +1388,9 @@ var readable = new stream.Readable({
13841388var writable = new stream.Writable ({
13851389 write : function (chunk , encoding , next ) {
13861390 // sets this._write under the hood
1391+
1392+ // An optional error can be passed as the first argument
1393+ next ()
13871394 }
13881395});
13891396
@@ -1392,6 +1399,9 @@ var writable = new stream.Writable({
13921399var writable = new stream.Writable ({
13931400 writev : function (chunks , next ) {
13941401 // sets this._writev under the hood
1402+
1403+ // An optional error can be passed as the first argument
1404+ next ()
13951405 }
13961406});
13971407```
@@ -1401,9 +1411,16 @@ var writable = new stream.Writable({
14011411var duplex = new stream.Duplex ({
14021412 read : function (n ) {
14031413 // sets this._read under the hood
1414+
1415+ // push data onto the read queue, passing null
1416+ // will signal the end of the stream (EOF)
1417+ this .push (chunk);
14041418 },
14051419 write : function (chunk , encoding , next ) {
14061420 // sets this._write under the hood
1421+
1422+ // An optional error can be passed as the first argument
1423+ next ()
14071424 }
14081425});
14091426
@@ -1412,9 +1429,16 @@ var duplex = new stream.Duplex({
14121429var duplex = new stream.Duplex ({
14131430 read : function (n ) {
14141431 // sets this._read under the hood
1432+
1433+ // push data onto the read queue, passing null
1434+ // will signal the end of the stream (EOF)
1435+ this .push (chunk);
14151436 },
14161437 writev : function (chunks , next ) {
14171438 // sets this._writev under the hood
1439+
1440+ // An optional error can be passed as the first argument
1441+ next ()
14181442 }
14191443});
14201444```
@@ -1424,9 +1448,20 @@ var duplex = new stream.Duplex({
14241448var transform = new stream.Transform ({
14251449 transform : function (chunk , encoding , next ) {
14261450 // sets this._transform under the hood
1451+
1452+ // generate output as many times as needed
1453+ // this.push(chunk);
1454+
1455+ // call when the current chunk is consumed
1456+ next ();
14271457 },
14281458 flush : function (done ) {
14291459 // sets this._flush under the hood
1460+
1461+ // generate output as many times as needed
1462+ // this.push(chunk);
1463+
1464+ done ();
14301465 }
14311466});
14321467```
0 commit comments