Rust WebAssembly, JavaScript and npm
What is WASM?
Web Assembly (abbreviated Wasm) is a binary instruction format for a stack-based virtual machine. Wasm is designed as a portable target for compilation of high-level languages like C/C++/Rust which enables deployment on the web for client and server applications.
WASM works alongside JavaScript to help supercharge heavy low-level tasks. Tasks that will benefit from Rust’s focus on performance.
Rust WebAssembly packages to package registries like npm and automatically generates binding code between Rust, WASM and JavaScript API’s.
It allows developers to take advantage of all the benefits of using JavaScript in a web environment. WASM could be classified as a supplement to Javascript taking advantage of the ease of use of JS while providing all the performant advantages of WASM.
WebAssembly can be used to write entire web applications or to replace small bits of existing applications that might not be performant enough with something that runs at near-native speed. Also, because WebAssembly is a native-like assembly format, many languages can be compiled down to it, meaning sharing code between other platforms and the web is much more practical.
Many different languages can be compiled down to WebAssembly. While the use of a programming language is always influenced by personal preference, there are many reasons why Rust is the best tool for the job.
Rust, ships with an extremely minimal runtime (basically just an allocator), the "hello, world" example compiles to 1.6KB on my machine without any post-compile size optimizations (which could bring it down further).
Rust can be practical for embedding inside existing apps and libraries. It makes it easy to create WebAssembly binaries that have JavaScript interfaces .
Note: The js-cardano-wasm project is listed on Github