-
Notifications
You must be signed in to change notification settings - Fork 7
New issue
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
readFileSync
Not Working as Expected when using Fetch
Backend
#61
Comments
Fetch
BackendreadFileSync
Not Working as Expected when using Fetch
Backend
Okay, I've successfully reproduced the issue. Edit: |
@dr-vortex Unfortunately, the issue still persists in v0.12.0. I've verified that I'm using the correct version, and after reproducing the issue again, I can confirm that the Could you please investigate further to identify the root cause and provide a fix? Thanks for your help and attention to this issue. |
@hawav Could you provide a complete stack trace of the error message? (Please copy and paste into a code block). |
@dr-vortex Here is the complete stack trace of the error message:
|
I hope you don't mind, I truncated the stack trace you provided to the part relevant to ZenFS. In any case, could you please make this change to the dist/emulation/sync.js file: @@ -100,6 +100,7 @@ function _openSync(_path, _flag, _mode, resolveSymlinks = true) {
stats = wrap('statSync', resolveSymlinks, path, cred);
}
catch (e) {
+ debugger;
// File does not exist.
switch (pathNotExistsAction(flag)) {
case ActionType.CREATE: Then comment with |
Of course, here is the content of
|
After upgrading to version 0.12.1 of To resolve this issue, I regenerated the npx -p @zenfs/core@0.12.1 make-index . -o index.json After executing this command, the error was resolved, and I was able to successfully retrieve the content of the file, which reads "Hello ZenFS!". Since I've confirmed that the issue has been resolved, I'm going to close this issue. If this issue persists for other users, it might be worth investigating the version compatibility between the older and newer versions of the Thank you for your attention to this matter! |
@hawav In hindsight, I believe your index.json may have been invalid for 0.11.*. This would explain why the issue was fixed on my side but not on yours. 0.12.0 did change the index.json format to use versioning, and to store the entries in a different way which actually keeps track of stats. |
@zenfs/core
versions: 0.11.2, 0.12.0Expected Behavior:
The
readFileSync
function should be able to fetch the content oftest.txt
from the remote server, just like thereadFile
function does.Actual Behavior:
The
readFileSync
function throws anENOENT
error, indicating that it cannot find the file, which is not true.Steps to Reproduce:
test.txt
in the directory with the content "Hello ZenFS!"make-index
script from ZenFS.npx -p @zenfs/core make-index . -o index.json
serve
on port 8080 with CORS enabled.serve . -p 8080 --cors
Fetch
Backend, pointing to the local server.readFile
function to successfully fetch test.txt from the remote server.The text was updated successfully, but these errors were encountered: