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

Function appendTransformResultSync

lib/internal/streams/iter/pull.js:287–316  ·  view source on GitHub ↗

* Append normalized transform result batches to an array (sync). * @param {Array } target * @param {*} result

(target, result)

Source from the content-addressed store, hash-verified

285 * @param {*} result
286 */
287function appendTransformResultSync(target, result) {
288 if (result === null) {
289 return;
290 }
291 if (isUint8ArrayBatch(result)) {
292 if (result.length > 0) {
293 ArrayPrototypePush(target, result);
294 }
295 return;
296 }
297 if (isUint8Array(result)) {
298 ArrayPrototypePush(target, [result]);
299 return;
300 }
301 if (typeof result === 'string') {
302 ArrayPrototypePush(target, [toUint8Array(result)]);
303 return;
304 }
305 if (isAnyArrayBuffer(result)) {
306 ArrayPrototypePush(target, [new Uint8Array(result)]);
307 return;
308 }
309 if (ArrayBufferIsView(result)) {
310 ArrayPrototypePush(target, [arrayBufferViewToUint8Array(result)]);
311 return;
312 }
313 for (const batch of processTransformResultSync(result)) {
314 ArrayPrototypePush(target, batch);
315 }
316}
317
318/**
319 * Process transform result (async).

Callers 1

Calls 5

isUint8ArrayBatchFunction · 0.85
isUint8ArrayFunction · 0.85
toUint8ArrayFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…