Skip to main content
要删除文件,请使用 Bun.file(path).delete()
https://mintcdn.com/bun-zhcndoc/cnUTwgMuf4cCrwC-/icons/typescript.svg?fit=max&auto=format&n=cnUTwgMuf4cCrwC-&q=85&s=e7767043c9e885c34f2d6c8fe2a95217delete-file.ts
// 删除文件
const file = Bun.file("path/to/file.txt");
await file.delete();

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

更多文件系统操作,请参见 文档 > API > 文件系统