Skip to content

open

Module @netwiv/api/plugins/fs · Kind Function

import { open } from '@netwiv/api/plugins/fs';

Open a file and resolve to an instance of {@linkcode FileHandle}. 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.

function open(path: string | URL, options?: OpenOptions | undefined): Promise<FileHandle>
import { open, BaseDirectory } from "@netwiv/api/plugins/fs"
const file = await open("foo/bar.txt", { read: true, write: true, baseDir: BaseDirectory.AppLocalData });
// Do work with file
await file.close();

Upstream since 2.0.0


Descriptions come from the pinned @tauri-apps/plugin-fs@2.5.2 declarations (MIT OR Apache-2.0); imports are shown with @netwiv/api paths.