Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

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

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

Synchronously open a file and return an instance of Deno.FsFile. The file does not need to previously exist if using the create or createNew open options. It is the caller's responsibility to close the file when finished with it.

const file = Deno.openSync("/foo/bar.txt", { read: true, write: true });
// Do work with file
Deno.close(file.rid);

Requires allow-read and/or allow-write permissions depending on options.

Parameters

path: string | URL
optional
options: OpenOptions