Bun

指南執行時

使用 Bun 刪除檔案

要刪除檔案,請使用 Bun.file(path).delete()

// Delete a file
const file = Bun.file("path/to/file.txt");
await file.delete();

// Now the file doesn't exist
const exists = await file.exists();
// => false

有關更多檔案系統操作,請參閱 文件 > API > 檔案系統