You can write a network device driver, which exports the network packages into JavaScript. The author already wrote a console device. So, not much of a deal.
https://github.com/joelseverin/linux-wasm/blob/master/patche...
https://github.com/joelseverin/linux-wasm/blob/master/patche...