此代碼片段將文件復制到磁盤上的另一個位置。
它使用快速的 Bun.write() API 有效地將數據寫入磁盤。第一個參數是 目標,如絕對路徑或 BunFile 實例。第二個是要寫入的 數據。
ts
const file = Bun.file("/path/to/original.txt");
await Bun.write("/path/to/copy.txt", file);請參閱 文檔 > API > File I/O 獲取 Bun.write() 的完整文檔。