# Bun Get the MIME type of a file

> Get the MIME type of a file

- Skill: `jarle/bun-get-the-mime-type-of-a-file` (Agent Skill)
- Install (CLI): `npx skillmds@latest add jarle/bun-get-the-mime-type-of-a-file`
- Raw SKILL.md: https://api.skillmd.com/api/skills/jarle/bun-get-the-mime-type-of-a-file/raw
- Safety review: pending (external: skill-scanner PASS, skillspector PASS)
- Works with: Claude Code, Claude.ai, OpenAI Codex
- Category: Coding & Dev Tools
- Author: jarle (https://skillmd.com/u/jarle)
- Updated: 2026-09-21
- Page: https://skillmd.com/skills/jarle/bun-get-the-mime-type-of-a-file

---


# Get the MIME type of a file

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  theme={"theme":{"light":"github-light","dark":"dracula"}}
const file = Bun.file("./package.json");
file.type; // application/json

const file = Bun.file("./index.html");
file.type; // text/html

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

***

Refer to [API > File I/O](/runtime/file-io) for more information on working with `BunFile`.

