zen-fs / core

A filesystem, anywhere.
https://zenfs.dev/core/
MIT License
134 stars 20 forks source link

Unable to read files from WebAccess with disableAsyncCache #65

Closed atty303 closed 5 months ago

atty303 commented 5 months ago
    await zenfs.configure({
        "/user": {
          backend: WebAccess,
          handle: await navigator.storage.getDirectory(),
          disableAsyncCache: true,
        },
      },
    });

    await zenfs.promises.readFile("/user/Path of Building/Settings.xml");

This code causes the following error

Error: Sync caching has been disabled for this async file system
    at WebAccessFS.checkSync (chunk-HSA2YHTI.js?v=21f4474c:9543:15)
    at WebAccessFS.syncSync (chunk-HSA2YHTI.js?v=21f4474c:9597:12)
    at PreloadFile.syncSync (chunk-HSA2YHTI.js?v=21f4474c:9181:13)
    at PreloadFile.readSync (chunk-HSA2YHTI.js?v=21f4474c:9323:10)
    at PreloadFile.read (chunk-HSA2YHTI.js?v=21f4474c:9297:30)
    at FileHandle.readFile (chunk-HSA2YHTI.js?v=21f4474c:12978:46)
    at async Object.readFile (chunk-HSA2YHTI.js?v=21f4474c:13245:12)
    at async DriverWorker.start (worker.ts?worker_file&type=module:95:9)

The file I am trying to access exists in OPFS.

image

james-pre commented 5 months ago

@atty303,

v0.12.5 should fix this issue. PreloadFile.read would call PreloadFile.readSync, which would read sync from the FS, which doesn't work on async-only FS.

Please let me know If you experience any other issues. I am so sorry that you have had to deal with so many bugs I've lost track of the exact number.

I appreciate you taking the time to help by reporting these issues.

atty303 commented 5 months ago

Ah, my app booted. But there seems to be a few more problems with WebAccess. ZenFS is a critical component of my app that cannot be replaced. Thank you.

james-pre commented 5 months ago

But there seems to be a few more problems with WebAccess.

Please tell me all the issues you are having and I will try to fix them as soon as I can.