-
I use ZenFS from an Emscripten app running on Web Worker. Is there a good way to reference LocalStorage in such a case? I will write about an experiment that I have implemented and that has not yet worked well. And it is mounted. GET/PUT/DELETE callbacks are forwarded to the main thread using Comlink. It is difficult to explain, but FS is unstable. Files cannot be read immediately after worker startup, or an exception occurs in Sync after a file is written. core/src/backends/AsyncStore.ts Line 455 in ca98b1e In particular, regarding this exception, we observed that |
Beta Was this translation helpful? Give feedback.
Replies: 0 comments 4 replies
-
I also tried the Port backend.
However, it failed with the following error. It seems to be trying to postMessage a local storage object.
|
Beta Was this translation helpful? Give feedback.
-
Hi @atty303!
I would recommend using the
This is really cool! I'm actually reworking the system of stores right now to use a single. unified
I recommend you inline the config, since it can be easier to understand and eliminates otherwise used variables. For your use case: const rootZip = await fetch(`${assetPrefix}/root.zip`);
await zenfs.configure({
mounts: {
'/root': {
backend: Zip,
zipData: await rootZip.arrayBuffer(),
name: 'root.zip',
},
'/user': {
name: 'LocalStorage',
backend: SimpleAsyncFS,
store: new SimpleAsyncStore(getCallback, putCallback, removeCallback),
},
},
});
This seems like a very frustrating bug to solve... I will create an issue to track it.
This was because |
Beta Was this translation helpful? Give feedback.
Hi @atty303!
I would recommend using the
Port
backend if you are using a web worker.This is really cool! I'm actually reworking the system of stores right now to use a single. unified
Store
class, with async mirroring.I recommend you inline the config, since it can be easier to understand and eliminates otherwise used variables.
For your use case: