Open
Description
Hey, I'm not sure how much effort this would be, so: would it be viable to support the Origin-Private Filesystem (OPFS) in the fds: []
argument to the WASI constructor? I suppose that you'd need to write a new Directory
subclass, which wraps a FileSystemDirectoryHandle or something like that?
// open directory in OPFS
const opfs = await navigator.storage.getDirectory();
const dir = await opfs.getDirectoryHandle("wasi-context", { create: true });
// initialize WASI shim
let wasi = new WASI(args, envs, [
new OpenFile(new File([])), // stdin
new OpenFile(new File([])), // stdout
new OpenFile(new File([])), // stderr
new WrapDirHandle(dir), // <----- ?!
]);
...
As far as I can tell, supporting this API would also allow you to use window.showDirectoryPicker()
and use an actual directory on the client machine for the execution context.
Metadata
Metadata
Assignees
Labels
No labels