# Check if a file exists (/docs/guides/read-file/exists)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 93 · updated: 2026-07-28 -->
Related: [Read a file to an ArrayBuffer](/docs/guides/read-file/arraybuffer.md), [Read a file to a Buffer](/docs/guides/read-file/buffer.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. Use the `.exists()` method to check if a file exists at the given path.

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

await file.exists(); // boolean;
```

***

See [File I/O](/runtime/file-io) for more on working with `BunFile`.
