bun-types
Version:
Type definitions and documentation for Bun, an incredibly fast JavaScript runtime
19 lines (13 loc) • 411 B
text/mdx
title: Delete a file
sidebarTitle: Delete file
mode: center
The `Bun.file()` function accepts a path and returns a `BunFile` instance. Use the `.delete()` method to delete the file.
```ts
const path = "/path/to/file.txt";
const file = Bun.file(path);
await file.delete();
```
See [Docs > API > File I/O](/docs/runtime/file-io#reading-files-bun-file) for complete documentation of `Bun.file()`.