core: Writing to specific folders not working?
Hi I’ve been using BrowserFS and recently translated to ZenFS and I am not clear at all on how this mounting system works.
So I want to do something with IndexedDB like
import {configure} from '@zenfs/core'
import * as fs from '@zenfs/core/promises'
import { IndexedDB } from '@zenfs/dom';
await configure({
mounts:{
'/data':IndexedDB
}
});
await fs.writeFile('/data/list.csv','A,B,C');
And I get
Error: No such file or directory
???
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 15 (7 by maintainers)
No the issue there was I didn’t see I had pasted in the script tag twice and it was causing overrides. I still can’t seem to work with the directory/subdirectory system in a way that makes any sense yet though. It seems like if I call mkdir it just creates a new StoreFS endpoint (which is still IDB in browser?) and I can’t do subdirectories e.g. /data/dir, which in the case of IDB would just be a key in a flat mapped dictionary anyway but would tell us to send it there vs e.g. /localstorage/dir
I also get different behavior if I use the
fsimport versus importing the @zenfs/core/promises, where I just get undefineds when checking directories and stuff with fs while the async calls actually error and enforce things for me.I’ve ended up just converting my whole wrapper file (which basically just documents the API) to native indexedDB calls and I get the exact behavior I want.
This is the hacky zenfs stuff I’ve tried but like createFolder errors in this usage. Other issue is I’m not accessing the same DB version each session so the application memory increases but I dont get the previous state on refresh.
I had this all working before in BrowserFS but there seem to be different caveats and it’s not obvious to me. wrapper.zip
Actually in isolation it works, that zip I linked had some other issues though. I’m gonna assume it’s on my end taskmanager.zip
I am bundling it with esbuild but same behavior with or without minification, here is my test application. Here is my test application. You can run it if you install the bundler system I use via
npm i -g tinybuildwhich just wraps esbuild with a dev server.taskmanager.zip