4 ms·
How does this work if there's no physical storage? Can WASI use memory as a virtual filesystem?
by gavinray 4y ago
How does this work if there's no physical storage?
Can WASI use memory as a virtual filesystem?
- shadowofneptune 4y agoThere is no WASI in browsers, but yes you can use filesystems in main memory. It's called a 'RAM disk.'
- cstrahan 4y agoWASI is just a set of standardized interfaces that any WASM host can implement. So while there’s no WASI out of the box on browsers, there’s nothing preventing you as a developer from bringing your own implementation (in which, for example, writes to stdout could sent to console.log, and files could be backed by an in memory VFS). See this article, where the mention (and link to) polyfill on browsers: https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webassembly-system-interface/ https://hacks.mozilla.org/2019/03/standardizing-wasi-a-webas...
- williamstein 4y agoYou can use anything you can use from Javascript. E.g., https://www.npmjs.com/package/memfs https://www.npmjs.com/package/memfs can be used with https://www.npmjs.com/package/@wapython/wasi https://www.npmjs.com/package/@wapython/wasi to provide a ramdisk, and similarly you can make it persist to indexdb or localStorage. This sort of thing is also built into emscripten. You can see this in action at https://jupyter.org/try-jupyter/lab/ https://jupyter.org/try-jupyter/lab/ It's also possible (on Google Chrome) to use browser API's to directly access your host computer's filesystem (see https://developer.mozilla.org/en-US/docs/Web/API/File_System_Access_API https://developer.mozilla.org/en-US/docs/Web/API/File_System...).
- e12e 4y agoFrom tfa: > Due to browser sandboxing there is no way to connect directly to the Postgres instance beyond the embedded psql interface that we establish for you. The current configuration allocates 512MB of memory for your Postgres instance, we may make this more configurable in the future. It’s in the browser, hence if you refresh you’re going to get a fresh instance, we haven’t created any persistence layers (yet).