將 Response 寫入檔案
使用 Bun.write() 將 Response 寫入磁碟。Bun 會將 Response 的正文寫入目標位置。
第一個引數是_目標位置_,例如絕對路徑或 BunFile 例項。第二個引數是要寫入的_資料_。
TypeScript
const result = await fetch("https://bun.sh");
const path = "./file.txt";
await Bun.write(path, result);
請參閱 Bun.write()。