Skip to content

readFile

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

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

Reads and resolves to the entire contents of a file as an array of bytes. TextDecoder can be used to transform the bytes to string if required.

function readFile(path: string | URL, options?: ReadFileOptions | undefined): Promise<Uint8Array<ArrayBuffer>>
import { readFile, BaseDirectory } from '@netwiv/api/plugins/fs';
const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource });

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.