deno / 1.23.2 / ~ / deno.open.html /

Deno.open

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. It is the callers responsibility to close the file when finished with it.

const file = await Deno.open("/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.

function open( path: string | URL , options?: OpenOptions) : Promise<FsFile>;
open( path: string | URL , options?: OpenOptions) : Promise<FsFile>

Parameters

path: string | URL
options?: OpenOptions optional

Return Type

Promise<FsFile>

© 2018–2022 the Deno authors
https://doc.deno.land/deno/stable/~/Deno.open