Another option is NODERAWFS. That just lets the code access the filesystem directly through node's APIs.
The main problem there is that node filesystem commands can behave differently on different OSes (because of underlying OS differences, probably, but could also be node oddities I guess). If you avoid corner cases though then this mode can work well. - Alon On Tue, May 21, 2019 at 11:56 AM 'Steven Johnson' via emscripten-discuss < [email protected]> wrote: > I have a bunch of pre-existing tests and benchmarks written in vanilla C++ > that load images (png, jpeg, etc) from the local filesystem as part of > their normal operation. I'm now cross-compiling them into wasm using > emscripten, and running them in a wasm-enabled shell (d8 or Node); what > options do I have that will minimize the amount of editing I need to do to > each test? > > Based on what I've read so far: > > - I could modify my Makefiles to use --embed_file when building each > test. Pro: the tests can work without editing the C++ source. Con: build > time is extremely slow; doesn't allow any test outputs or byproducts to be > easily written to local filesystem (e.g for debugging) > - If I require Node instead of d8, I could use FS.mount(NODEFS) to map > the local filesystem in a way that the wasm code can see. Pros: actually > provides file access and file output. Cons: requires adding awkward > boilerplate to every test I want to run in this environment; requires Node > rather than d8 > > Are there other options I'm missing? (Fortunately, running these tests in > a browser environment isn't yet a requirement, though it may be eventually.) > > (A close-enough-to-ideal solution for me would be if Node allowed some > commandline / config setup that did the filesystem mapping automatically; > if such a thing exists, I haven't found it, but I am a newcomer to Node so > could have easily missed it.) > > -- > You received this message because you are subscribed to the Google Groups > "emscripten-discuss" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/emscripten-discuss/CAM%3DdnvcJHX%3DgYipxm_gQKPcuP60n%3DVb7-fDNYn9xqmsTtORX7w%40mail.gmail.com > <https://groups.google.com/d/msgid/emscripten-discuss/CAM%3DdnvcJHX%3DgYipxm_gQKPcuP60n%3DVb7-fDNYn9xqmsTtORX7w%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "emscripten-discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/CAEX4NpSGiNxN45NPS-ZB%2BzZ6S3u2sTZCD8nay9evQEvnapibmg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
