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 > FileSystem 以了解更多檔案系統操作。