emscripten-core / emscripten-core/emscripten

How can I add dynamic file path access ability to emscripten's current File api?

Open
#17,051 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
C++
Stars
27.6k
Forks
3.6k
Avg merge
1d 1h
Merged PRs (30d)
105

Description

I've noticed emcc's `-lworkerfs.js --preload-file` can only build a fixed file set,
However i need the wasm C++ code fopen can open any local file path (with potential support from server side)

https://emscripten.org/docs/porting/files/Synchronous-Virtual-XHR-Backed-File-System-Usage.html#synchronous-virtual-xhr-backed-file-system-usage says can use `FS.createLazyFile` api to create a mapping from a virtual wasm fs path to server side url path, but documentation says MUST used with --pre-js option.

Which means, --pre-js inject code is run at the begining of worker thread? Can I call `FS.createLazyFile` Just-in-Time to worker thread (before wasm C++ fopen run), in that case, I can support dynamic file path access...

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.