()
| 467 | // ============================================================================= |
| 468 | |
| 469 | async function testPipeToWithTransform() { |
| 470 | const { |
| 471 | compressGzip, |
| 472 | decompressGzip, |
| 473 | } = require('zlib/iter'); |
| 474 | const { pull } = require('stream/iter'); |
| 475 | |
| 476 | const compressed = []; |
| 477 | const writable = new Writable({ |
| 478 | write(chunk, encoding, cb) { |
| 479 | compressed.push(Buffer.from(chunk)); |
| 480 | cb(); |
| 481 | }, |
| 482 | }); |
| 483 | |
| 484 | const writer = fromWritable(writable, { backpressure: 'block' }); |
| 485 | await pipeTo(from('hello via transform'), compressGzip(), writer); |
| 486 | |
| 487 | const decompressed = await text( |
| 488 | pull(from(Buffer.concat(compressed)), decompressGzip()), |
| 489 | ); |
| 490 | assert.strictEqual(decompressed, 'hello via transform'); |
| 491 | } |
| 492 | |
| 493 | // ============================================================================= |
| 494 | // Dispose support |
no test coverage detected
searching dependent graphs…