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整理维护