# Read a file to a Buffer (/docs/guides/read-file/buffer)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 150 · updated: 2026-07-28 -->
Related: [Read a file to an ArrayBuffer](/docs/guides/read-file/arraybuffer.md), [Check if a file exists](/docs/guides/read-file/exists.md), [Read a JSON file](/docs/guides/read-file/json.md), [Get the MIME type of a file](/docs/guides/read-file/mime.md), [Read a file as a ReadableStream](/docs/guides/read-file/stream.md), [Read a file as a string](/docs/guides/read-file/string.md)

The `Bun.file()` function accepts a path and returns a `BunFile` instance. `BunFile` extends `Blob`, so you can read the file lazily in a variety of formats.

To read the file into a `Buffer`, read it as an `ArrayBuffer` with `.arrayBuffer()`, then pass the result to `Buffer.from()`.

```ts index.ts icon="/icons/typescript.svg"
const path = "/path/to/package.json";
const file = Bun.file(path);

const arrbuf = await file.arrayBuffer();
const buffer = Buffer.from(arrbuf);
```

***

See [Buffer](/runtime/binary-data#buffer) for more on working with `Buffer` and other binary data formats in Bun.
