MCPcopy Index your code
hub / github.com/nodejs/node / testPipeToWithTransform

Function testPipeToWithTransform

test/parallel/test-stream-iter-writable-interop.js:469–491  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

467// =============================================================================
468
469async 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

Calls 9

fromWritableFunction · 0.85
pipeToFunction · 0.85
compressGzipFunction · 0.85
decompressGzipFunction · 0.85
concatMethod · 0.80
pullFunction · 0.70
requireFunction · 0.50
fromFunction · 0.50
textFunction · 0.50

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…