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.
Optional
import { readFile, BaseDirectory } from '@tauri-apps/plugin-fs';const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource }); Copy
import { readFile, BaseDirectory } from '@tauri-apps/plugin-fs';const contents = await readFile('avatar.png', { baseDir: BaseDirectory.Resource });
2.0.0
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.