nx.js
NamespacesSwitchFunctions

readFile

readFile(path, opts?): Promise<null | ArrayBuffer>

Returns a Promise which resolves to an ArrayBuffer containing the contents of the file at path.

Parameters

ParameterType
pathPathLike
opts?ReadFileOptions

Returns

Promise<null | ArrayBuffer>

Example

const buffer = await Switch.readFile('sdmc:/switch/awesome-app/state.json');
const gameState = JSON.parse(new TextDecoder().decode(buffer));

On this page