Bun

指南寫入檔案

使用 Bun 刪除檔案

Bun.file() 函式接受一個路徑並返回一個 BunFile 例項。使用 .delete() 方法來刪除檔案。

const path = "/path/to/file.txt";
const file = Bun.file(path);

await file.delete();

有關 Bun.file() 的完整文件,請參閱 文件 > API > 檔案 I/O