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

Is there a way to implement InMemory DB that places whole files into single buffer? #379

Open
vitonsky opened this issue Dec 25, 2024 · 0 comments

Comments

@vitonsky
Copy link

I need some emscripten FS that would make able to dump content and load content fast, but all operations must happens in RAM, because all data are secret data encrypted on high level.

Ideally it must be a virtual FS that places whole data in single buffer, like tar archive or something.

Is it possible with BrowserFS? Maybe this project have solution for that, or you may navigate me to another solution, or explain how to implement this code myself with BrowserFS?

Ideally the API would looks kinda

// Initializing
const fs = new CustomFS();

// First time we set an empty buffer or maybe create formatted buffer with some util
const content = new Uint8Array().buffer;
fs.setBuffer(content);

// Now custom FS acts with files from our buffer. Read, write, etc.
// We may dump buffer immediately, to snapshot our FS,
// and then load buffer next run, to continue from snapshot state
dumpData(content);

I work on note-taking app that uses PGlite that uses emscripten FS. Users may encrypt their workspace, this is core feature, so i can't just mount NodeFS, since secret data would be placed naked on user disk and may be recovered later. I have issue in PGlite repo with more details if you need a context.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant