File tree Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Expand file tree Collapse file tree 2 files changed +20
-2
lines changed Original file line number Diff line number Diff line change @@ -6,11 +6,13 @@ const {
66} = primordials ;
77
88function isReadable ( obj ) {
9- return ! ! ( obj && typeof obj . pipe === 'function' ) ;
9+ return ! ! ( obj && typeof obj . pipe === 'function' &&
10+ typeof obj . on === 'function' ) ;
1011}
1112
1213function isWritable ( obj ) {
13- return ! ! ( obj && typeof obj . write === 'function' ) ;
14+ return ! ! ( obj && typeof obj . write === 'function' &&
15+ typeof obj . on === 'function' ) ;
1416}
1517
1618function isStream ( obj ) {
Original file line number Diff line number Diff line change @@ -1337,3 +1337,19 @@ const net = require('net');
13371337 assert . strictEqual ( res , '123' ) ;
13381338 } ) ) ;
13391339}
1340+
1341+ {
1342+ const content = 'abc' ;
1343+ pipeline ( Buffer . from ( content ) , PassThrough ( { objectMode : true } ) ,
1344+ common . mustSucceed ( ( ) => { } ) ) ;
1345+
1346+ let res = '' ;
1347+ pipeline ( Buffer . from ( content ) , async function * ( previous ) {
1348+ for await ( const val of previous ) {
1349+ res += String . fromCharCode ( val ) ;
1350+ yield val ;
1351+ }
1352+ } , common . mustSucceed ( ( ) => {
1353+ assert . strictEqual ( res , content ) ;
1354+ } ) ) ;
1355+ }
You can’t perform that action at this time.
0 commit comments