summaryrefslogtreecommitdiff
path: root/crates/parser/README.md
diff options
context:
space:
mode:
Diffstat (limited to 'crates/parser/README.md')
-rw-r--r--crates/parser/README.md21
1 files changed, 21 insertions, 0 deletions
diff --git a/crates/parser/README.md b/crates/parser/README.md
new file mode 100644
index 0000000..5772bb7
--- /dev/null
+++ b/crates/parser/README.md
@@ -0,0 +1,21 @@
+# `tinywasm_parser`
+
+This crate provides a parser that can parse WebAssembly modules into a TinyWasm module. It is based on
+[`wasmparser_nostd`](https://crates.io/crates/wasmparser_nostd) and used by [`tinywasm`](https://crates.io/crates/tinywasm).
+
+## Features
+
+- `std`: Enables the use of `std` and `std::io` for parsing from files and streams.
+- `logging`: Enables logging of the parsing process using the `log` crate.
+
+## Usage
+
+```rust
+use tinywasm_parser::{Parser, TinyWasmModule};
+let bytes = include_bytes!("./file.wasm");
+
+let parser = Parser::new();
+let module: TinyWasmModule = parser.parse_module_bytes(bytes).unwrap();
+let mudule: TinyWasmModule = parser.parse_module_file("path/to/file.wasm").unwrap();
+let module: TinyWasmModule = parser.parse_module_stream(&mut stream).unwrap();
+```