emscripten-core / emscripten-core/emscripten

[WasmFS] FS.readFile on main thread

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

Description

When exporting and sharing files, we need to move the file into a File or a Blob object.

` const blob = new Blob( [FS.readFile( path )], { 'type': type } );`

With an asynchronous wasmfs file system (OPFS, IndexedDB), `FS.readFile( path )` appears to cause Safari browsers to freeze. Chrome and Firefox seem to work, but with a warning about blocking on the main thread. Perhaps there could be a way to access an OPFS file directly as a blob without using FS.readFile and not asynchronously?

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.