Guides · File System
Delete a file
Delete a file from disk with the .delete() method of a BunFile.
The Bun.file() function accepts a path and returns a BunFile instance. Use the .delete() method to delete the file.
const path = "/path/to/file.txt";
const file = Bun.file(path);
await file.delete();
See Bun.file().