Open kaizhu256 opened 3 years ago
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.
@tlively is this the same thing you are working on with wasmfs+opfs?
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.
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
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
write