> ## Documentation Index
> Fetch the complete documentation index at: https://bun.zhcndoc.com/llms.txt
> Use this file to discover all available pages before exploring further.

# 删除文件

要删除文件，请使用 `Bun.file(path).delete()`。

```ts delete-file.ts icon="https://mintcdn.com/bun-zhcndoc/cnUTwgMuf4cCrwC-/icons/typescript.svg?fit=max&auto=format&n=cnUTwgMuf4cCrwC-&q=85&s=e7767043c9e885c34f2d6c8fe2a95217" theme={"theme":{"light":"github-light","dark":"dracula"}}
// 删除文件
const file = Bun.file("path/to/file.txt");
await file.delete();

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

***

更多文件系统操作，请参见 [文档 > API > 文件系统](/runtime/file-io)。
