mirror of
https://github.com/tauri-apps/tauri-docs.git
synced 2026-01-31 00:35:16 +01:00
Corrects read only example for open function (#3158)
This commit is contained in:
committed by
GitHub
parent
30461b4e6c
commit
cbfcd76904
@@ -256,7 +256,9 @@ Always call `file.close()` when you are done manipulating the file.
|
||||
read: true,
|
||||
baseDir: BaseDirectory.AppData,
|
||||
});
|
||||
const buf = new Uint8Array();
|
||||
|
||||
const stat = await file.stat();
|
||||
const buf = new Uint8Array(stat.size);
|
||||
await file.read(buf);
|
||||
const textContents = new TextDecoder().decode(buf);
|
||||
await file.close();
|
||||
|
||||
Reference in New Issue
Block a user