Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/desktop-cgi/wasm-ruby
wasm-ruby files for ruby versions
https://github.com/desktop-cgi/wasm-ruby
Last synced: about 1 month ago
JSON representation
wasm-ruby files for ruby versions
- Host: GitHub
- URL: https://github.com/desktop-cgi/wasm-ruby
- Owner: desktop-cgi
- License: mit
- Created: 2023-07-04T09:42:29.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-12-25T12:02:15.000Z (about 1 year ago)
- Last Synced: 2024-04-22T03:42:25.522Z (8 months ago)
- Language: Shell
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# wasm-ruby
wasm-ruby files for ruby versionsWebAssembly port of CRuby by Emscripten with a thin JavaScript wrapper to run ruby scripts in node.js
#### WebAssembly port of CRuby with WASI.
##### USAGE:
```
import fs from "fs/promises";
import { DefaultRubyVM } from "@ruby/wasm-wasi/dist/node.cjs.js";const main = async () => {
const binary = await fs.readFile(
// Tips: Replace the binary with debug info if you want symbolicated stack trace.
// (only nightly release for now)
// "./node_modules/ruby-head-wasm-wasi/dist/ruby.debug+stdlib.wasm"
"./node_modules/ruby-head-wasm-wasi/dist/ruby.wasm"
);
const module = await WebAssembly.compile(binary);
const { vm } = await DefaultRubyVM(module);vm.eval(`
luckiness = ["Lucky", "Unlucky"].sample
puts "You are #{luckiness}"
`);
};main();
```[Other RUBY WASI WASM Usage demos](https://github.com/desktop-cgi/wasm-ruby/demos/demos.node.head.wasi.wasm.js)
[https://www.npmjs.com/package/ruby-head-wasm-wasi](https://www.npmjs.com/package/ruby-head-wasm-wasi)
[https://www.npmjs.com/package/ruby-head-wasm-emscripten](https://www.npmjs.com/package/ruby-head-wasm-emscripten)
[https://www.npmjs.com/package/ruby-wasm-emscripten](https://www.npmjs.com/package/ruby-wasm-emscripten): Note: The emscripten demos for the port of ruby.wasm currently has issues and throws an error.
### BUILD REPO SCRIPTS:
[https://github.com/ruby/ruby.wasm](https://github.com/ruby/ruby.wasm)