---
title: Get the MIME type of a file
sidebarTitle: Get MIME type
mode: center
---

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`.
