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 @@ -1371,3 +1371,19 @@ const net = require('net');
1371
1371
assert . strictEqual ( res , '123' ) ;
1372
1372
} ) ) ;
1373
1373
}
1374
+
1375
+ {
1376
+ const content = 'abc' ;
1377
+ pipeline ( Buffer . from ( content ) , PassThrough ( { objectMode : true } ) ,
1378
+ common . mustSucceed ( ( ) => { } ) ) ;
1379
+
1380
+ let res = '' ;
1381
+ pipeline ( Buffer . from ( content ) , async function * ( previous ) {
1382
+ for await ( const val of previous ) {
1383
+ res += String . fromCharCode ( val ) ;
1384
+ yield val ;
1385
+ }
1386
+ } , common . mustSucceed ( ( ) => {
1387
+ assert . strictEqual ( res , content ) ;
1388
+ } ) ) ;
1389
+ }
You can’t perform that action at this time.
0 commit comments