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

x/ayonli_jsext/lib.deno.d.ts>Deno.open

A JavaScript extension package for building strong and modern applications.
Latest
function Deno.open
allow-read
allow-write
import { Deno } from "https://deno.land/x/ayonli_jsext@v0.9.72/lib.deno.d.ts";
const { open } = Deno;

Open a file and resolve to an instance of Deno.FsFile. The file does not need to previously exist if using the create or createNew open options. The caller may have the resulting file automatically closed by the runtime once it's out of scope by declaring the file variable with the using keyword.

using file = await Deno.open("/foo/bar.txt", { read: true, write: true });
// Do work with file

Alternatively, the caller may manually close the resource when finished with it.

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

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

Parameters

path: string | URL
optional
options: OpenOptions

Returns

Promise<FsFile>