We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I followed the sample code on this document https://v2.tauri.app/plugin/file-system/
import { open, BaseDirectory } from '@tauri-apps/plugin-fs'; const file = await open('foo/bar.txt', { read: true, baseDir: BaseDirectory.App, }); const buf = new Uint8Array(); await file.read(buf); const textContents = new TextDecoder().decode(buf); await file.close();
but it reads zero bytes,
I found out that I need to preallocate buf, otherwise it won't read anything. this behavior is different from what's documented.
const buf = new Uint8Array(100);
What I have to do is the following:
const stat = await fileHandle.stat(); const contentBuffer = new Uint8Array(stat.size); await fileHandle.read(contentBuffer); await fileHandle.close();
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I followed the sample code on this document https://v2.tauri.app/plugin/file-system/
but it reads zero bytes,
I found out that I need to preallocate buf, otherwise it won't read anything. this behavior is different from what's documented.
What I have to do is the following:
The text was updated successfully, but these errors were encountered: