Skip to content
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

discussion - feasibility to integrate https://wicg.github.io/file-system-access/ #12428

Open
kaizhu256 opened this issue Oct 3, 2020 · 4 comments
Labels

Comments

@kaizhu256
Copy link

a serious limitation of downstream libraries like sql.js is inability to persist largish databases (e.g. 1gb) to local filesystem.

that might finally be overcome with newly proposed https://wicg.github.io/file-system-access (note spec's motivation appears mainly saving data in web-editors and ides).
they have an experimental demo here

feasibility question - what additional spec read/write features are needed to integrate emscripten with file-system-access?

spec's current read/write capabilities are (from what i gather):

read

  • await FileSystemHandle.file() // method returns blob/file object

write

  • await FileSystemWritableFileStream.write(data)
  • await FileSystemWritableFileStream.write({ type: "write", data: data })
  • await FileSystemWritableFileStream.write({ type: "write", position: position, data: data })
  • await FileSystemWritableFileStream.write({ type: "seek", position: position })
  • await FileSystemWritableFileStream.write({ type: "truncate", size: size })
@stale
Copy link

stale bot commented Apr 17, 2022

This issue has been automatically marked as stale because there has been no activity in the past year. It will be closed automatically if no further activity occurs in the next 30 days. Feel free to re-open at any time if this issue is still relevant.

@stale stale bot added the wontfix label Apr 17, 2022
@sbc100
Copy link
Collaborator

sbc100 commented Apr 19, 2022

@tlively is this the same thing you are working on with wasmfs+opfs?

@stale stale bot removed the wontfix label Apr 19, 2022
@tlively
Copy link
Member

tlively commented Apr 19, 2022

Very related, but the API in the OP accesses and stores data to the user's file system rather than a private file system as in OPFS.

@ProgrammerIn-wonderland

Very related, but the API in the OP accesses and stores data to the user's file system rather than a private file system as in OPFS.

tested, you can replace the let root = await navigator.storage.getDirectory(); in the compiled output with

        let root;
        await new Promise((res, rej) => {
          const button = document.createElement("button")
          button.onclick = async () => {
            root = await window.showDirectoryPicker({mode:"readwrite"});
            res();
          }
          button.textContent = "Click me to proceed";
          document.body.appendChild(button);
        })

and it works fine, the emscripten code can access the local files. The button is created because showDirectoryPicker can only be run as a result of user interaction

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: No status
Development

No branches or pull requests

4 participants