--- name: Read a file to a Uint8Array --- The `Bun.file()` function accepts a path and returns a `BunFile` instance. The `BunFile` class extends `Blob` and allows you to lazily read the file in a variety of formats. To read the file into a `Uint8Array` instance, retrieve the contents of the `BunFile` as an `ArrayBuffer` with `.arrayBuffer()`, then pass it into the `Uint8Array` constructor. ```ts const path = "/path/to/package.json"; const file = Bun.file(path); const arrBuffer = await file.arrayBuffer(); const byteArray = new Uint8Array(arrBuffer); byteArray[0]; // first byteArray byteArray.length; // length of byteArray ``` --- Refer to [API > Binary data > Typed arrays](/docs/api/binary-data#typedarray) for more information on working with `Uint8Array` and other binary data formats in Bun. gacy'>4-legacy Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/packages/astro/src/cli/check (unfollow)
AgeCommit message (Expand)AuthorFilesLines
2023-07-11Filter out astro from `peerDependencies` in `astro add` (#7620)Gravatar Chris Swithinbank 2-1/+7
2023-07-11[ci] formatGravatar bluwy 1-1/+1
2023-07-11Refactor simple CLI commands (#7619)Gravatar Bjorn Lu 12-115/+123
2023-07-10fix: `astro info` command fallback for package manager (#7618)Gravatar Emanuele Stoppa 2-1/+7
2023-07-10Add CLI startup speed benchmark (#7617)Gravatar Bjorn Lu 5-11/+95
2023-07-10[ci] formatGravatar bluwy 1-1/+1