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 {
6
6
} = primordials ;
7
7
8
8
function isReadable ( obj ) {
9
- return ! ! ( obj && typeof obj . pipe === 'function' ) ;
9
+ return ! ! ( obj && typeof obj . pipe === 'function' &&
10
+ typeof obj . on === 'function' ) ;
10
11
}
11
12
12
13
function isWritable ( obj ) {
13
- return ! ! ( obj && typeof obj . write === 'function' ) ;
14
+ return ! ! ( obj && typeof obj . write === 'function' &&
15
+ typeof obj . on === 'function' ) ;
14
16
}
15
17
16
18
function isStream ( obj ) {
Original file line number Diff line number Diff line change @@ -1337,3 +1337,19 @@ const net = require('net');
1337
1337
assert . strictEqual ( res , '123' ) ;
1338
1338
} ) ) ;
1339
1339
}
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