Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> > "it can be compiled to WebAssembly in order to run [..] in the browser."

> and NodeJS

Wait... what? Why?



So you can run NodeJS code in the browser, even though both are JS-based, NodeJS has a bunch of APIs that deal with things like file systems that the browser doesn't have.

For example, imagine you have a lib that converts markdown to html, but the lib happens to write the files directly to the disk, hence it can't be used in the browser. If you compile the nodejs runtime to wasm with a WASI that maps the file system to local storage, then you can just read the file from local storage after invoking the lib.

Just saying it is a technical possibility, this kind of approach is really only meant to be used if you _really_ just want to run some lib in the browser, no matter how slow it gets.

Also technically if you could compile JS to wasm (without nodejs, so more like how you run C through wasm right now) then you don't need to care about browser versions and JS api polyfills while still using JS.


nah, this is about running wasm version of this inside nodejs.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: