@Crimson Wizard well, for start, there are no files, we fake things using library_fs.js. This API should be replaced by WasmFS sometime soon. Emscripten itself gives us some pseudo-posix thing in the browser.
Anyway, when files are saved we actually write things (file contents and things like permissions, path, and other stuff) in IndexedDB - this is done through library_fs.js, and not by hand. IndexedDB is basically like a key-value DB with some considerations for the browser - things like domain and isolation of information.
OK, so we have this bunch of information, we want to download these files, now we can't just download, we need to convert these into files, and we can't download a bunch of things in a click, we need to turn all these files in a single file. We need to
So beyond doing all this stuff - where most time is spent testing on the different platforms and browsers.
My suggestion is wait a bit for showDirectoryPicker, with that, we could just write/read files directly to disk.
Anyway, when files are saved we actually write things (file contents and things like permissions, path, and other stuff) in IndexedDB - this is done through library_fs.js, and not by hand. IndexedDB is basically like a key-value DB with some considerations for the browser - things like domain and isolation of information.
OK, so we have this bunch of information, we want to download these files, now we can't just download, we need to convert these into files, and we can't download a bunch of things in a click, we need to turn all these files in a single file. We need to
- know the game file save dir from JS world
- no one is writing to any of these files, need to make sure of this - or work in the synced files
- we need to zip or pack all the files in there
- we probably need a JS zip library for this or zip capabilities in engine we can link from JS to use to pack these files
- we need some UI for this - seriously, ui is not easy
- need to test and make sure this works in all browsers - Safari really likes to try to open things in a tab instead of triggering a download, so we need to work on that
- need to add documentation to explain what to do with these files
So beyond doing all this stuff - where most time is spent testing on the different platforms and browsers.
My suggestion is wait a bit for showDirectoryPicker, with that, we could just write/read files directly to disk.