Bun.file() 函数接受一个路径并返回一个 BunFile 实例。BunFile 类继承自 Blob,因此使用 .type 属性来读取 MIME 类型。
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
有关使用 BunFile 的更多信息,请参阅 API > 文件 I/O。