how to retrieve files generated by a wasm program?

34 views
Skip to first unread message

Shi Yan

unread,
Dec 7, 2019, 3:51:52 AM12/7/19
to emscripten-discuss
I created a wasm program with a preloaded folder /asset

the program, upon finish, will generate a file log.txt under /asset/log.txt.

How can I get this file?

I run the program with node.js. It runs fine, but I don't know where to get the result file back. Thanks

Mehdi Sabwat

unread,
Dec 7, 2019, 7:41:52 AM12/7/19
to emscripte...@googlegroups.com

--
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 emscripten-disc...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/emscripten-discuss/0753311c-5ec0-49db-be7e-7ceb1db86efd%40googlegroups.com.

Alon Zakai

unread,
Dec 8, 2019, 5:12:25 PM12/8/19
to emscripte...@googlegroups.com
Another option is to use the JS FS API to access the in-memory filesystem. Here is readFile for example:


You can also traverse the FS data directly, at a lower level. Here is how test_poppler in the test suite gets a file's data, for example:

MEMFS.getFileDataAsRegularArray(FS.root.contents['filename-1.ppm'])


Reply all
Reply to author
Forward
0 new messages