# Get the MIME type of a file (/docs/guides/read-file/mime)

<!-- agent-signals: reading_time_min: 1 · est_tokens: 119 · 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), [Check if a file exists](/docs/guides/read-file/exists.md), [Read a JSON file](/docs/guides/read-file/json.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. The `BunFile` class extends `Blob`, so use the `.type` property to read the MIME type.

```ts
const file = Bun.file("./package.json");
file.type; // application/json;charset=utf-8

const file = Bun.file("./index.html");
file.type; // text/html;charset=utf-8

const file = Bun.file("./image.png");
file.type; // image/png
```

***

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