Bun

指南寫入檔案

使用 Bun 刪除檔案

Bun.file() 函數接受路徑並返回 BunFile 實例。使用 .delete() 方法刪除檔案。

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

await file.delete();

請參閱文件 > API > 檔案 I/O 以取得 Bun.file() 的完整文件。