Skip to content
This repository was archived by the owner on Sep 12, 2023. It is now read-only.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

No description, website, or topics provided.

Resources

Stars

9 stars

Watchers

2 watching

Forks

Releases

Packages

Used by

Contributors

Languages