wasm-tools 1.253.0

CLI tools for interoperating with WebAssembly files
Documentation
Removes custom sections from an input WebAssembly file.

This command will by default strip all custom sections such as DWARF debugging
information from a wasm file. It will not strip the `name`, `component-type`, or
`dylink.0` sections by default unless the `--all` flag is passed.

Usage: wasm-tools strip [OPTIONS] [INPUT]

Arguments:
  [INPUT]
          Input file to process.
          
          If not provided or if this is `-` then stdin is read entirely and
          processed. Note that for most subcommands this input can either be a
          binary `*.wasm` file or a textual format `*.wat` file.

Options:
  -o, --output <OUTPUT>
          Where to place output.
          
          Required when printing WebAssembly binary output.
          
          If not provided, then stdout is used.

  -v, --verbose...
          Use verbose output (-v info, -vv debug, -vvv trace)

      --color <COLOR>
          Configuration over whether terminal colors are used in output.
          
          Supports one of `auto|never|always|always-ansi`. The default is to
          detect what to do based on the terminal environment, for example by
          using `isatty`.
          
          [default: auto]

  -a, --all
          Remove all custom sections, regardless of name

  -d, --delete <REGEX>
          Remove custom sections matching the specified regex

  -t, --wat
          Output the text format of WebAssembly instead of the binary format

  -h, --help
          Print help (see a summary with '-h')

Examples:

Suppose foo.wasm has the following textual representation:

(module
  (type (;0;) (func))
  (func (;2;) (type 0)
    (local i32)
    global.get 0
  )
  (@custom "linking" (after code) "")
  (@custom "reloc.CODE" (after code) "")
  (@custom "target_features" (after code) "")
)

    # Remove all custom sections from foo.wasm and print the textual form of
    # the output to stdout.
    $ wasm-tools strip -a -t foo.wasm
(module
  (type (;0;) (func))
  (func (;0;) (type 0)
    (local i32)
    global.get 0
  )
)
    # Remove only the custom sections whose names match the regexp `linking`
    # and print the textual form of the output to stdout.
    $ wasm-tools strip -d linking foo.wasm -t
(module
  (type (;0;) (func))
  (func (;0;) (type 0)
    (local i32)
    global.get 0
  )
  (@custom "reloc.CODE" (after code) "")
  (@custom "target_features" (after code) "")
)

   # Remove all custom sections from foo.wasm and save the binary output to
   # the file out.wasm.
   $ wasm-tools strip -a foo.wasm -o out.wasm

Exit status:
    0 on success,
    nonzero if the input file fails to parse.