3

I would like to create configuration for my webassembly app. It just needs to be able to store some key-value pairs: whether it's JSON, XML, .cfg, .csv or .txt any will do. Is it possible to do this with webassembly? Do I need to serve the config files or how will the configuration file need to be delivered to the client? What path will I use to open the file?

Further info: I'm using straight C with emcc. My build command is:

emcc \
main.c \
-s USE_SDL=2 \
-O3 \
-s WASM=1 \
-o main.js 

I am not exposing anything to javascript. It's all wasm manipulating the canvas with SDL. I haven't written any javascript.

I'm currently serving with Python's simple http server using python3 -m http.server 8080

I have already tried using libconfig but I got stuck with compiling it and having it find the config file.

Neil
  • 3,020
  • 4
  • 25
  • 48

1 Answers1

2

You may use VFS for that start here https://emscripten.org/docs/api_reference/Filesystem-API.html#filesystem-api-filesystems and then just parse them in you c/c++.