-
-
Notifications
You must be signed in to change notification settings - Fork 58
Closed
Description
Source code
use std::fs::read_link;
fn main() {
let link = read_link("./link.txt").unwrap();
println!("{:?}", link);
}
import { readFile } from 'node:fs/promises'
import { join } from 'node:path'
import { fileURLToPath } from 'node:url'
import { WASI } from 'node:wasi'
const wasi = new WASI({
preopens: {
'/': join(fileURLToPath(import.meta.url), '..'),
},
version: 'preview1',
env: process.env,
})
const wasm = await WebAssembly.compile(
await readFile(new URL('./target/wasm32-wasi/debug/wasi-read-link.wasm', import.meta.url))
)
const instance = await WebAssembly.instantiate(wasm, wasi.getImportObject())
wasi.start(instance)
wasmtime run --dir $(pwd)::/ target/wasm32-wasi/debug/wasi-read-link.wasm
node index.mjs
Metadata
Metadata
Assignees
Labels
No labels