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

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

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