Skip to content

Commit ff67f45

Browse files
authored
feat: add both file and wasm-tools output for wasm binaries (#285)
1 parent 783f916 commit ff67f45

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

component-model/src/design/why-component-model.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,12 @@ Here's what the `file` command outputs for a sample `.wasm` file:
2626
$ file adder.wasm
2727
adder.wasm: WebAssembly (wasm) binary module version 0x1 (MVP)
2828
```
29+
The file can also be inspected
30+
using [the `wasm-tools` CLI](https://github.com/bytecodealliance/wasm-tools):
31+
```console
32+
$ wasm-tools print adder.wasm | head -1
33+
(module
34+
```
2935

3036
A core module is a set of definitions.
3137
Kinds of definitions include:
@@ -144,7 +150,18 @@ Conceptually, a component is a WebAssembly binary
144150
(which may or may not contain modules)
145151
that is restricted to interact
146152
only through the modules' imported and exported functions.
147-
Components use a different binary format.
153+
Components use a different binary format:
154+
```console
155+
$ file add.component.wasm
156+
add.component.wasm: WebAssembly (wasm) binary module version 0x1000d
157+
```
158+
Inspecting the file with the `wasm-tools` CLI
159+
shows more clearly that it contains a component:
160+
```
161+
$ wasm-tools print add.component.wasm | head -1
162+
(component
163+
```
164+
148165
Compared to core modules, components also use a richer
149166
mechanism by default for expressing the types of functions: _interfaces_.
150167

0 commit comments

Comments
 (0)