Corrects read only example for open function (#3158)

This commit is contained in:
Christian Pavilonis
2025-02-05 12:22:36 -06:00
committed by GitHub
parent 30461b4e6c
commit cbfcd76904

View File

@@ -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();