UNPKG

@thi.ng/file-io

Version:

Assorted file I/O utils (with logging support) for NodeJS/Bun

10 lines (9 loc) 250 B
import { readFileSync } from "node:fs"; const readBinary = (path, logger) => { logger?.debug("reading file:", path); const buf = readFileSync(path); return new Uint8Array(buf.buffer, buf.byteOffset, buf.byteLength); }; export { readBinary };