> ## 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()` 函数接受一个路径并返回一个 `BunFile` 实例。使用 `.delete()` 方法来删除该文件。

```ts theme={"theme":{"light":"github-light","dark":"dracula"}}
const path = "/path/to/file.txt";
const file = Bun.file(path);

await file.delete();
```

***

完整的 `Bun.file()` 文档请参见 [文档 > API > 文件 I/O](/runtime/file-io#reading-files-bun-file)。
