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