emscripten-core / emscripten-core/emscripten

How to access to FS in Module, before promise is completed?

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

Description

There was a change introduced in 1.39.16
```
Change the factory function created by using the `MODULARIZE` build option to return a Promise instead of the module instance.
```

Before the change I have been doing something like this:
```
let Module = await import('wasm.js');
let module = Module.default( ... );
useFS(module.FS);
module.then( ... );
```
So I was able to start using filesystem while webassembly code is loading and compiling.

Now `module` is a Promise and I can't access `FS` before it is completed.
```
let Module = await import('wasm.js');
let module = await Module.default( ... ); // have to wait for a long time
useFS(module.FS);
```

Is there a way to access FS before this Promise is completed?

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.