Skip to content

Bun gibt stdout als BunFile mit der Bun.stdout-Eigenschaft frei. Dies kann als Ziel für Bun.write() verwendet werden.

Dieser Code schreibt eine Datei nach stdout, ähnlich dem cat-Befehl in Unix.

ts
const path = "/path/to/file.txt";
const file = Bun.file(path);
await Bun.write(Bun.stdout, file);

Siehe Docs > API > File I/O für vollständige Dokumentation von Bun.write().

Bun von www.bunjs.com.cn bearbeitet