Files
2026-08-27 21:09:14 +00:00

17 lines
491 B
Plaintext

---
title: Copy a file to another location
sidebarTitle: Copy file
mode: center
---
Use [`Bun.write()`](/runtime/file-io#writing-files-bun-write) to copy a file to another location on disk. The first argument is a _destination_, like an absolute path or `BunFile` instance. The second argument is the _data_ to write.
```ts
const file = Bun.file("/path/to/original.txt");
await Bun.write("/path/to/copy.txt", file);
```
---
See [`Bun.write()`](/runtime/file-io#writing-files-bun-write).