You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 7, 2020. It is now read-only.
Thought it would be worth getting the API discussion going here. The previous suggestion was a quick gist for discussion, thinking about it more I think it could be useful to:
Support raw buffer / Web Assembly.Module input
Not do any automatic internal caching of module compilation, and instead separating compilation from execution as Web Assembly itself does.
Simplify the start event model by separating init from exec.
Here's the adjusted suggestion for that approach:
import{createWASICommand}from'wasi';// async init (because Web Assembly)// Support three overloads - path string | Buffer | WebAssembly.Moduleconstcmd=awaitcreateWASICommand('./path.wasm' : String);constcmd=awaitcreateWASICommand(Buffer.from(bytes) : {buffer: ArrayBuffer});constcmd=awaitcreateWASICommand(module: WebAssembly.Module);constcmdProcess=cmd.exec(['args'],{
env,// defaults to an empty object
modulePath,// defaults to the createWASICommand path string if provided});// same sort of events, properties and methods as child processcmdProcess.stdincmdProcess.stdoutcmdProcess.stderrcmdProcess.on('close',()=>{});cmdProcess.kill();
This is still very much a bikeshed so feel free to get those colours out further... :)