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
In both js and js_browser backends, File.read() call seems to read 0 bytes
js
js_browser
File.read()
import os mut buf := []u8{len: 10} f := os.open('/etc/hosts') or { panic(err) } n := f.read(mut &buf) or { panic(err) } println(buf[..n])
Using the js backend: expected to either read a non-zero amount of bytes, or raise an error.
Using the js_browser: expected to either fail compilation (since File I/O is unavailable in the browser), or for os.open() to always return an error.
os.open()
$ v run read_file.v # runs as expected [49, 50, 55, 46, 48, 46, 48, 46, 49, 32] $ v -o read_file.js read_file.v && node read_file.js [] $ v -b js_browser -o read_file.js read_file.v && node read_file.js []
No response
V 0.4.4 ac2dcc2
NixOS 23.11 (Tapir) Node v18.18.2
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote. Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered:
os: fix File.read() in JS backends (fix #20501) (#20633)
2d68230
os: fix File.read() in JS backends (fix vlang#20501) (vlang#20633)
e696fcb
4fb09b6
Successfully merging a pull request may close this issue.
Describe the bug
In both
js
andjs_browser
backends,File.read()
call seems to read 0 bytesReproduction Steps
Expected Behavior
Using the
js
backend: expected to either read a non-zero amount of bytes, or raise an error.Using the
js_browser
: expected to either fail compilation (since File I/O is unavailable in the browser), or foros.open()
to always return an error.Current Behavior
Possible Solution
No response
Additional Information/Context
No response
V version
V 0.4.4 ac2dcc2
Environment details (OS name and version, etc.)
NixOS 23.11 (Tapir)
Node v18.18.2
Note
You can use the 👍 reaction to increase the issue's priority for developers.
Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.
The text was updated successfully, but these errors were encountered: