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

Function testPipeToWithTransforms

test/parallel/test-stream-iter-pipeto.js:107–123  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

105
106// PipeTo with transforms
107async function testPipeToWithTransforms() {
108 const chunks = [];
109 const writer = {
110 write(chunk) { chunks.push(new TextDecoder().decode(chunk)); },
111 };
112 const upper = (batch) => {
113 if (batch === null) return null;
114 return batch.map((c) => {
115 const out = new Uint8Array(c);
116 for (let i = 0; i < out.length; i++)
117 out[i] -= (out[i] >= 97 && out[i] <= 122) * 32;
118 return out;
119 });
120 };
121 await pipeTo(from('hello'), upper, writer);
122 assert.strictEqual(chunks.join(''), 'HELLO');
123}
124
125// PipeToSync with transforms
126async function testPipeToSyncWithTransforms() {

Callers 1

Calls 3

pipeToFunction · 0.85
fromFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…