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 @@ -1339,3 +1339,19 @@ const net = require('net');
13391339 assert . strictEqual ( res , '123' ) ;
13401340 } ) ) ;
13411341}
1342+
1343+ {
1344+ const content = 'abc' ;
1345+ pipeline ( Buffer . from ( content ) , PassThrough ( { objectMode : true } ) ,
1346+ common . mustSucceed ( ( ) => { } ) ) ;
1347+
1348+ let res = '' ;
1349+ pipeline ( Buffer . from ( content ) , async function * ( previous ) {
1350+ for await ( const val of previous ) {
1351+ res += String . fromCharCode ( val ) ;
1352+ yield val ;
1353+ }
1354+ } , common . mustSucceed ( ( ) => {
1355+ assert . strictEqual ( res , content ) ;
1356+ } ) ) ;
1357+ }
You can’t perform that action at this time.
0 commit comments