Skip to main content

writeTextFile

function Deno.writeTextFile
allow-read
allow-write
Jump to headingwriteTextFile(
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 Jump to heading

Jump to headingpath: string | URL
Jump to headingdata: string | ReadableStream<string>

Return Type Jump to heading

Promise<void>
Back to top