#wasm-edge #run-time #extension #tensorflow #own #js #http

bin+lib wasmedge_quickjs

Create your own JavaScript runtime and extension APIs for WasmEdge

1 unstable release

0.2.0 Oct 7, 2021

#941 in WebAssembly

Download history 7/week @ 2023-12-03 48/week @ 2023-12-10 26/week @ 2023-12-17 40/week @ 2023-12-24 16/week @ 2023-12-31 46/week @ 2024-01-07 2/week @ 2024-01-14 19/week @ 2024-01-21 12/week @ 2024-01-28 12/week @ 2024-02-18 27/week @ 2024-02-25 8/week @ 2024-03-03 14/week @ 2024-03-10 3/week @ 2024-03-17

53 downloads per month

MIT/Apache

1.5MB
4.5K SLoC

Contains (static library, 1MB) lib/libquickjs.a

Run JavaScript in WebAssembly

Now supporting wasmedge socket for HTTP requests and Tensorflow in JavaScript programs!

Prerequisites

Install Rust and wasmedge CLI tool. Make sure that you use the -e all option to install the WasmEdge Tensorflow extensions if you want to try the Tensorflow examples below.

rustup target add wasm32-wasi

Hello js

Build

$ cargo build --target wasm32-wasi --release

Run

$ cd example_js
$ wasmedge --dir .:. ../target/wasm32-wasi/release/wasmedge_quickjs.wasm hello.js WasmEdge Runtime

HTTP Request

Build

$ cargo build --target wasm32-wasi --release

Run

Bonus: This example also shows how to import another JavaScript file into the current program.

$ cd example_js
$ wasmedge --dir .:. ../target/wasm32-wasi/release/wasmedg_quickjs.wasm http_demo.js

TensorFlow

Build

Note: Build the QuickJS interpreter with the WasmEdge Tensorflow extension.

$ cargo build --target wasm32-wasi --release --features=tensorflow

Run

$ cd example_js/tensorflow_lite_demo
$ wasmedge-tensorflow --dir .:. ../../target/wasm32-wasi/release/wasmedge_quickjs.wasm main.js

Optional: Get static-lib & binding.rs

If you want to build a custom libquickjs.a to export some static c function.

See [quickjs-wasi]

run quickjs-wasi/lib/build.sh

Dependencies

~16MB
~155K SLoC