MCPcopy Create free account
hub / github.com/apify/impit / toUint8Array

Function toUint8Array

impit-node/index.wrapper.js:48–50  ·  view source on GitHub ↗
(chunk)

Source from the content-addressed store, hash-verified

46// Stream chunks may be strings (e.g. a ReadableStream or Node stream that wasn't
47// fed bytes); encode them so they aren't coerced to zero bytes by Uint8Array.set.
48function toUint8Array(chunk) {
49 return typeof chunk === 'string' ? new TextEncoder().encode(chunk) : new Uint8Array(chunk);
50}
51
52function concatUint8Arrays(chunks) {
53 const totalLength = chunks.reduce((acc, chunk) => acc + chunk.length, 0);

Callers 1

#serializeBodyMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…