> ## Documentation Index
> Fetch the complete documentation index at: https://bun.ll1025.cn/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/span-inc/82N53aP7NFbaCVSl/icons/typescript.svg?fit=max&auto=format&n=82N53aP7NFbaCVSl&q=85&s=787d39d6a7d96d7f9540dc74344eba23" theme={null}
// 删除文件
const file = Bun.file("path/to/file.txt");
await file.delete();

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

***

参见 [文件 I/O](/runtime/file-io) 了解更多文件系统操作。
