| Crates.io | nodejs-helper |
| lib.rs | nodejs-helper |
| version | 0.0.3 |
| created_at | 2020-04-27 05:19:46.227498+00 |
| updated_at | 2020-04-27 19:51:46.993248+00 |
| description | Call Node.js functions from Rust |
| homepage | https://cloud.secondstate.io/ |
| repository | https://github.com/second-state/nodejs-helper |
| max_upload_size | |
| id | 234545 |
| size | 9,262 |
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
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
Demo code is available here