Skip to content

Commit

Permalink
Use ConsoleStdout in README example
Browse files Browse the repository at this point in the history
  • Loading branch information
amesgen committed Jan 13, 2024
1 parent d01f39a commit b150eba
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ npm install @bjorn3/browser_wasi_shim --save
```

```javascript
import { WASI, File, OpenFile, PreopenDirectory } from "@bjorn3/browser_wasi_shim";
import { WASI, File, OpenFile, ConsoleStdout, PreopenDirectory } from "@bjorn3/browser_wasi_shim";

let args = ["bin", "arg1", "arg2"];
let env = ["FOO=bar"];
let fds = [
new OpenFile(new File([])), // stdin
new OpenFile(new File([])), // stdout
new OpenFile(new File([])), // stderr
ConsoleStdout.lineBuffered(msg => console.log(`[WASI stdout] ${msg}`)),
ConsoleStdout.lineBuffered(msg => console.warn(`[WASI stderr] ${msg}`)),
new PreopenDirectory(".", {
"example.c": new File(new TextEncoder("utf-8").encode(`#include "a"`)),
"hello.rs": new File(new TextEncoder("utf-8").encode(`fn main() { println!("Hello World!"); }`)),
Expand Down

0 comments on commit b150eba

Please sign in to comment.