WebAssembly.sh - An online WebAssembly Terminal to run WASI modules directly on your browser
Just last week we released Wasmer-JS, a collection of open-source installable packages for running WASI modules in Node and the browser.
📣 Today, with the back-to-back announcement, we are excited to announce WebAssembly.sh.
WebAssembly.sh is an open-source and installable Progressive Web App (PWA) terminal fully powered by WebAssembly and Wasmer-JS, that uses the WebAssembly Package Manager and local files to run server-side Wasm WASI modules in a shell-like interface 🖥
We are stoked to share WebAssembly.sh, because we feel like it has a lot to offer for a variety of use cases:
The goals of WASI go far beyond CLI-styled applications. However, the current API supports them and we are excited to introduce these use cases today for the community!
Let’s take a step back, and see how we can use WebAssembly.sh. 🤔
Let’s take a quick walkthrough of WebAssembly.sh.
On first load (~200KB) you will be greeted with a welcome message. But behind the scenes, all of the PWA magic happens. The service worker will be installed, and now WebAssembly.sh will work offline. 🤯
You will also notice WebAssembly.sh can be installed natively either through the “_Add to HomeScreen_” on mobile, or the install icon in the URL bar on Desktop browsers. All of this functionality can be confirmed and investigated through your browser’s developers tool. In particular we used Chrome’s Lighthouse Audit to help us build for / enable the PWA features in WebAssembly.sh. 💡
When WebAssembly.sh tries to run a command, first it will check if the WASI-compiled module is already installed and cached. If not, WebAssembly.sh will default to searching on WAPM to then download and run that module. ⚡
quickjs, and then you should be able to start using the engine!
Next, let’s upload and run our own custom WASI modules. For this, we can use the package manager for WebAssembly.sh,
️WAPM on WebAssembly.sh, is a command to manage Wasm Modules. It is intended to behave similar to the native WAPM Package Manager. Using the command
wapm upload , a file upload dialog will show up, allowing you to upload your own
.wasm file to be installed as a command. For example, if we install
wapm upload , then you can run the command
mywasi to run the Wasm / WASI module.
Wapm also supports other functions such as:
wapm install to manually install a package and/or a package version from Wapm,
wapm list to list all available commands, and
wapm uninstall to delete a command installed by Wapm. Another nice feature is that the commands installed by Wapm are saved to IndexedDB using idb-keyval so that installed modules work between sessions, and even work offline! 📦
We can also get Wasm modules to work with one another! Similar to a Unix environment, WebAssembly.sh supports piping. It uses Comlink in the background, to spin up multiple workers and passed standard input and standard output between them. Using the example we mentioned earlier in the article, we can run
cowsay WebAssembly | lolcat , and we get a colorful cowsay shown in our terminal! 🐄🌈
With that short introduction, you should be able to hit the ground running with WebAssembly.sh! 🏃
We are super excited to see how people use WebAssembly.sh, and we hope you enjoy using it as much as we did making it. 😄
Looking for an attractive & user-friendly web developer? HourlyDeveloper.io, a leading web, and mobile app development company, offers web developers for hire through flexible engagement models. You can **[Hire Web...
Find the best PWA App Developers, to choose from a well-researched list of top PWA development companies and help you to develop Progressive Web Apps for your business.
With the rapid development in technology, the old ways to do business have changed completely. A lot more advanced and developed ways are ...
You name the business and I will tell you how web development can help you promote your business. If it is a startup or you seeking some...
Build your eCommerce project by hiring our expert eCommerce Website developers. Our Dedicated Web Designers develop powerful & robust website in a short span of time.