Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/deno/cli/dts/lib.deno.ns.d.ts>Deno.writeTextFileSync

A modern runtime for JavaScript and TypeScript.
Go to Latest
function Deno.writeTextFileSync
allow-read
allow-write
import { Deno } from "https://deno.land/x/deno@v1.28.1/cli/dts/lib.deno.ns.d.ts";
const { writeTextFileSync } = Deno;

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