1, WASM writing

#[no_mangle]
pub extern fn fib(x: i32) - >i32 {
 return 3 * x;
}
Copy the code

This code is written using Rust.

Rust writes WASM to query data by itself

2, Deno

import { fib } from "./rustWasm_lib.wasm";
const result = fib(5);
console.log(result);

$ deno -A test.ts
Compile file:///Users/mac/WasmProjects/rustWasm/src/test.ts
Copy the code

3. Deno still has the problem of Path module introduction, as follows

(1) This reading method will lead to the problem of path introduction

import {readFileSync} from 'deno';
readFileSync("./bbb.txt");
Copy the code

(2) This way of reading is correct

await Deno.readFile("./bbb.txt");
Copy the code