Commit 982b1eb9 authored by nagayama15's avatar nagayama15

Change wasm directory

parent 4e9105a6
...@@ -12,19 +12,16 @@ const server = app.listen(port, () => { ...@@ -12,19 +12,16 @@ const server = app.listen(port, () => {
console.log(`server listening at port ${port}`); console.log(`server listening at port ${port}`);
}); });
app.get( app.get("/add.wasm", async (req: express.Request, res: express.Response) => {
"/wasm/add.wasm", const path = `${__dirname}/../wasm/add.wasm`;
async (req: express.Request, res: express.Response) => { const watermark = req.query.v || "";
const path = `${__dirname}/../wasm/add.wasm`;
const watermark = req.query.v || "";
res.writeHead(200, { "Content-Type": "application/wasm" }); res.writeHead(200, { "Content-Type": "application/wasm" });
console.time("kyut"); console.time("kyut");
const process = childProcess.spawn(watermarker, [path, watermark, "-"]); const process = childProcess.spawn(watermarker, [path, watermark, "-"]);
process.stdout.pipe(res); process.stdout.pipe(res);
res.on("finish", () => console.timeEnd("kyut")); res.on("finish", () => console.timeEnd("kyut"));
} });
);
app.use(express.static(`${__dirname}/../static`)); app.use(express.static(`${__dirname}/../static`));
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
(async () => { (async () => {
// Import wasm module // Import wasm module
const wasm = await WebAssembly.instantiateStreaming( const wasm = await WebAssembly.instantiateStreaming(
fetch("wasm/add.wasm") fetch("add.wasm")
); );
const { add2, add3 } = wasm.instance.exports; const { add2, add3 } = wasm.instance.exports;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment