Skip to content

要刪除文件,請使用 Bun.file(path).delete()

ts
// 刪除文件
const file = Bun.file("path/to/file.txt");
await file.delete();

// 現在文件不存在了
const exists = await file.exists();
// => false

請參閱 文檔 > API > 文件系統 獲取更多文件系統操作。

Bun學習網由www.bunjs.com.cn整理維護