Skip to main content

normalizeFileReadResultToArrayBuffer

FitFileViewer - API Documentation v30.0.1


FitFileViewer - API Documentation / main/ipc/fileReadPayload / normalizeFileReadResultToArrayBuffer

Function: normalizeFileReadResultToArrayBuffer()

normalizeFileReadResultToArrayBuffer(value: unknown): ArrayBuffer

Defined in: main/ipc/fileReadPayload.ts:50

Normalizes a binary fs.readFile result into the exact ArrayBuffer that should be returned to the renderer.

Node Buffers and Uint8Arrays often share a larger backing ArrayBuffer. Slicing by byteOffset/byteLength avoids leaking unrelated backing bytes across the IPC boundary.

Parameters​

value​

unknown

Returns​

ArrayBuffer

Throws​

Error when the file read result is not binary data or exceeds the FIT file cap.