3 releases

0.0.3 Apr 27, 2020
0.0.2 Apr 27, 2020
0.0.1 Apr 27, 2020

#1144 in WebAssembly

Download history 34/week @ 2024-09-23 21/week @ 2024-12-02 33/week @ 2024-12-09

54 downloads per month

MIT/Apache

8KB
159 lines

Call Node.js functions from Rust

Crates.io Crates.io Crates.io

Prerequisite

Must have Node.js installed with the following packages.

npm i ssvm sync-request better-sqlite3
npm i -g ssvmup
npm i -g wasm-pack

How to use

Add cargo dependency

[dependencies]
nodejs-helper = "0.0.3"

Make Node.js Javascript API calls from Rust code!

#[wasm_bindgen]
pub fn utc_now() {
  let now: String = nodejs_helper::date::utc_string();
  nodejs_helper::console::log("UTC time: ");
  nodejs_helper::console::log(&now);
}

The Rust code must be compiled to WebAssembly and run from inside Node.js. See how

Examples

Demo code is available here

Documentation

See how the examples work

Dependencies

~0.7–1.3MB
~27K SLoC

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy