readFile
readFile(
path
,options?
):Promise
<Uint8Array
<ArrayBufferLike
>>
Defined in: plugins/fs/guest-js/index.ts:739
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.
string
| URL
Promise
<Uint8Array
<ArrayBufferLike
>>
import { readFile, BaseDirectory } from '@tauri-apps/plugin-fs';const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource });
2.0.0
© 2025 Tauri Contributors. CC-BY / MIT