Skip to main content
此代码片段将文件复制到磁盘上的另一个位置。 它使用快速的 Bun.write() API 高效地将数据写入磁盘。第一个参数是一个 目标,例如绝对路径或 BunFile 实例。第二个参数是要写入的 数据
const file = Bun.file("/path/to/original.txt");
await Bun.write("/path/to/copy.txt", file);

完整的 Bun.write() 文档请参见 文档 > API > 文件 I/O