File tree 2 files changed +20
-2
lines changed
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 @@ -1339,3 +1339,19 @@ const net = require('net');
1339
1339
assert . strictEqual ( res , '123' ) ;
1340
1340
} ) ) ;
1341
1341
}
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