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

Function testPipeToSyncWithTransforms

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

Source from the content-addressed store, hash-verified

124
125// PipeToSync with transforms
126async function testPipeToSyncWithTransforms() {
127 const chunks = [];
128 const writer = {
129 writeSync(chunk) { chunks.push(new TextDecoder().decode(chunk)); return true; },
130 };
131 const upper = (batch) => {
132 if (batch === null) return null;
133 return batch.map((c) => {
134 const out = new Uint8Array(c);
135 for (let i = 0; i < out.length; i++)
136 out[i] -= (out[i] >= 97 && out[i] <= 122) * 32;
137 return out;
138 });
139 };
140 pipeToSync(fromSync('hello'), upper, writer);
141 assert.strictEqual(chunks.join(''), 'HELLO');
142}
143
144async function testPipeToWriterTransformMethodIgnored() {
145 const chunks = [];

Callers 1

Calls 3

pipeToSyncFunction · 0.85
fromSyncFunction · 0.50
joinMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…