@lembeh/io
v0.1.1
Published
AssemblyScript bindings for Lembeh (WASM guest SDK). Not a Node runtime library.
Readme
@lembeh/io
AssemblyScript guest bindings for Lembeh.
This package is not a Node.js runtime library. It is imported by AssemblyScript code and compiled into WebAssembly.
Usage (AssemblyScript)
import { Request, Response } from "@lembeh/io";
export function lembeh_handle(req: i32, res: i32): void {
const r = new Request(req);
const w = new Response(res);
const buf = new Uint8Array(4096);
const ptr = buf.dataStart;
while (true) {
const n = r.read(ptr, buf.length);
if (n <= 0) break;
if (w.write(ptr, n) < 0) break;
}
w.end();
}