Skip to main content
Deno.writeTextFile - Deno documentation
function Deno.writeTextFile
allow-read
allow-write
writeTextFile(
path: string | URL,
data: string | ReadableStream<string>,
options?: WriteFileOptions,
): Promise<void>

Write string data to the given path, by default creating a new file if needed, else overwriting.

await Deno.writeTextFile("hello1.txt", "Hello world\n");  // overwrite "hello1.txt" or create it

Requires allow-write permission, and allow-read if options.create is false.

Parameters

path: string | URL
data: string | ReadableStream<string>
optional
options: WriteFileOptions

Return Type

Promise<void>