Deno.writeFileSync
Синхронно записывает data в заданный path, по умолчанию создавая новый файл, если необходимо, иначе перезаписывая.
const encoder = new TextEncoder();
const data = encoder.encode("Hello world\n");
Deno.writeFileSync("hello1.txt", data); // overwrite "hello1.txt" or create it
Deno.writeFileSync("hello2.txt", data, { create: false }); // only works if "hello2.txt" exists
Deno.writeFileSync("hello3.txt", data, { mode: 0o777 }); // set permissions on new file
Deno.writeFileSync("hello4.txt", data, { append: true }); // add data to the end of the file
Требует разрешения allow-write и allow-read, если options.create равно false.
writeFileSync(path: string | URL, data: Uint8Array, options?: WriteFileOptions): voidТип возвращаемого значения
void
© 2018–2022 the Deno authors
https://doc.deno.land/deno/stable/~/Deno.writeFileSync