Skip to content

Bun.file() 함수는 경로를 허용하며 BunFile 인스턴스를 반환합니다. BunFile 클래스는 Blob 을 확장하므로 .type 속성을 사용하여 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

BunFile 작업에 대한 자세한 내용은 API > 파일 I/O 를 참조하세요.

Bun by www.bunjs.com.cn 편집