Skip to content
NewBun 1.4.5 is out. Release notes
AphrodyBun

Guides · File System

Delete files

Delete a file with Bun.file(path).delete() and confirm its removal with .exists().

To delete a file, use Bun.file(path).delete().

delete-file.ts
// Delete a file
const file = Bun.file("path/to/file.txt");
await file.delete();

// Now the file doesn't exist
const exists = await file.exists();
// => false

See File I/O for more filesystem operations.