emscripten-core / emscripten-core/emscripten
Expose wasmfs_create_file to JS
Open
- Dominant language
- C++
- Stars
- 27.6k
- Forks
- 3.6k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 105
Description
Right now there's no way for JS code to call `wasmfs_create_file` directly with a specific backend, which is a key use case for WASMFS. I suggest adding the following function to `libwasmfs.js`:
```
createFile(path, mode, backend) {
return FS.handleError(withStackSave(() => __wasmfs_create_file(module.stringToUTF8OnStack(path), mode, backend)));
}
```
We already have ways to create backends in JS code (e.g. OPFS and FETCHFS both define `createBackend`), but no way to use them apart from `FS.mount` which is unsuitable for single files.
Contributor guide
Assessment
This issue has not been assessed yet.