Skip to content

A função Bun.file() aceita um caminho e retorna uma instância BunFile. A classe BunFile estende Blob, então use a propriedade .type para ler o tipo MIME.

ts
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

Consulte API > File I/O para mais informações sobre trabalhar com BunFile.

Bun by www.bunjs.com.cn edit