MCPcopy Index your code
hub / github.com/coder/coder / getArrayBuffer

Function getArrayBuffer

site/src/utils/tar.ts:342–353  ·  view source on GitHub ↗
(file: string | ArrayBuffer | Uint8Array | Blob)

Source from the content-addressed store, hash-verified

340}
341
342function getArrayBuffer(file: string | ArrayBuffer | Uint8Array | Blob) {
343 if (typeof file === "string") {
344 return utf8Encode(file).buffer;
345 }
346 if (file instanceof ArrayBuffer) {
347 return file;
348 }
349 if (ArrayBuffer.isView(file)) {
350 return new Uint8Array(file).buffer;
351 }
352 return file.arrayBuffer();
353}

Callers 2

readFileMethod · 0.85
addFileMethod · 0.85

Calls 1

utf8EncodeFunction · 0.85

Tested by

no test coverage detected