#wasm-module #read-write #section #file #ls

app wasm-cs

Read and write custom sections in WASM modules

1 stable release

1.0.0 Nov 13, 2023

#686 in WebAssembly

Download history 8/week @ 2024-02-23 6/week @ 2024-03-01 17/week @ 2024-03-29 2/week @ 2024-04-05 53/week @ 2024-04-19

72 downloads per month

MIT license

10KB
164 lines

wasm-cs

Read and write custom sections in WASM modules.

Install

cargo install --locked wasm-cs

Usage

List custom sections

$ wasm-cs file.wasm ls
hello (6 bytes)
test (47 bytes)

Read a custom section

$ wasm-cs file.wasm read SECTION_NAME
Length: 47 (0x2f) bytes
0000:   54 68 65 20  71 75 69 63  6b 20 62 72  6f 77 6e 20   The quick brown
0010:   66 6f 78 20  6a 75 6d 70  73 20 6f 76  65 72 20 74   fox jumps over t
0020:   68 65 20 6c  61 7a 79 20  64 6f 67 2e  2e 2e 0a      he lazy dog....
$ wasm-cs file.wasm read SECTION_NAME -f hex
54686520717569636b2062726f776e20666f78206a756d7073206f76657220746865206c617a7920646f672e2e2e0a
$ wasm-cs file.wasm read SECTION_NAME -f base64
VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZy4uLgo=
$ wasm-cs file.wasm read SECTION_NAME -f binary
The quick brown fox jumps over the lazy dog...

Write a custom section

$ wasm-cs file.wasm write SECTION_NAME < FILE

Thanks

wasm-cs is a fork of wasm-custom-sections, by Sven Sauleau.

License: MIT

Dependencies

~4.5MB
~79K SLoC