update index.js from universal lambda project
All checks were successful
Generic zig build / build (push) Successful in 26s
All checks were successful
Generic zig build / build (push) Successful in 26s
This commit is contained in:
parent
68e6e14bea
commit
e8b0ff50fe
6
index.js
6
index.js
|
@ -1,4 +1,4 @@
|
||||||
import demoWasm from "demo.wasm";
|
import customWasm from "custom.wasm";
|
||||||
export default {
|
export default {
|
||||||
async fetch(request, _env2, ctx) {
|
async fetch(request, _env2, ctx) {
|
||||||
const stdout = new TransformStream();
|
const stdout = new TransformStream();
|
||||||
|
@ -11,7 +11,7 @@ export default {
|
||||||
});
|
});
|
||||||
const wasi = new WASI({
|
const wasi = new WASI({
|
||||||
args: [
|
args: [
|
||||||
"./demo.wasm",
|
"./custom.wasm",
|
||||||
// In a CLI, the first arg is the name of the exe
|
// In a CLI, the first arg is the name of the exe
|
||||||
"--url=" + request.url,
|
"--url=" + request.url,
|
||||||
// this contains the target but is the full url, so we will use a different arg for this
|
// this contains the target but is the full url, so we will use a different arg for this
|
||||||
|
@ -22,7 +22,7 @@ export default {
|
||||||
stdin: request.body,
|
stdin: request.body,
|
||||||
stdout: stdout.writable
|
stdout: stdout.writable
|
||||||
});
|
});
|
||||||
const instance = new WebAssembly.Instance(demoWasm, {
|
const instance = new WebAssembly.Instance(customWasm, {
|
||||||
wasi_snapshot_preview1: wasi.wasiImport
|
wasi_snapshot_preview1: wasi.wasiImport
|
||||||
});
|
});
|
||||||
ctx.waitUntil(wasi.start(instance));
|
ctx.waitUntil(wasi.start(instance));
|
||||||
|
|
Loading…
Reference in New Issue
Block a user