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

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

Deno.writeTextFileSync("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
optional
options: WriteFileOptions

Return Type

void
Back to top