{"id":13638412,"url":"https://github.com/rustwasm/wasm-snip","last_synced_at":"2025-04-04T14:06:31.196Z","repository":{"id":28283256,"uuid":"117025885","full_name":"rustwasm/wasm-snip","owner":"rustwasm","description":"`wasm-snip` replaces a WebAssembly function's body with an `unreachable`","archived":false,"fork":false,"pushed_at":"2023-03-20T08:58:44.000Z","size":157,"stargazers_count":232,"open_issues_count":9,"forks_count":20,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-28T13:07:53.162Z","etag":null,"topics":["wasm"],"latest_commit_sha":null,"homepage":null,"language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rustwasm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-10T23:54:53.000Z","updated_at":"2025-03-16T03:49:35.000Z","dependencies_parsed_at":"2024-11-09T06:24:18.233Z","dependency_job_id":"c5f97649-6d3e-4d77-88c5-86d2867f6031","html_url":"https://github.com/rustwasm/wasm-snip","commit_stats":{"total_commits":49,"total_committers":6,"mean_commits":8.166666666666666,"dds":"0.34693877551020413","last_synced_commit":"1f6d51a2e62cb0dc3760e3b702f232b95304ac06"},"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustwasm%2Fwasm-snip","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustwasm%2Fwasm-snip/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustwasm%2Fwasm-snip/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rustwasm%2Fwasm-snip/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rustwasm","download_url":"https://codeload.github.com/rustwasm/wasm-snip/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247190250,"owners_count":20898702,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["wasm"],"created_at":"2024-08-02T01:00:45.433Z","updated_at":"2025-04-04T14:06:31.175Z","avatar_url":"https://github.com/rustwasm.png","language":"Rust","funding_links":[],"categories":["Manipulating (optimization, transformation, instrumentation)","Rust","Development Tools"],"sub_categories":["Optimizing `.wasm` Binaries"],"readme":"\u003cdiv align=\"center\"\u003e\n\n  \u003ch1\u003e\u003ccode\u003ewasm-snip\u003c/code\u003e\u003c/h1\u003e\n\n  \u003cstrong\u003e\u003ccode\u003ewasm-snip\u003c/code\u003e replaces a Wasm function's body with an \u003ccode\u003eunreachable\u003c/code\u003e instruction.\u003c/strong\u003e\n\n  \u003cp\u003e\n    \u003ca href=\"https://travis-ci.org/rustwasm/wasm-snip\"\u003e\u003cimg src=\"https://img.shields.io/travis/rustwasm/wasm-snip.svg?style=flat-square\" alt=\"Build Status\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/wasm-snip\"\u003e\u003cimg src=\"https://img.shields.io/crates/v/wasm-snip.svg?style=flat-square\" alt=\"Crates.io version\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://crates.io/crates/wasm-snip\"\u003e\u003cimg src=\"https://img.shields.io/crates/d/wasm-snip.svg?style=flat-square\" alt=\"Download\" /\u003e\u003c/a\u003e\n    \u003ca href=\"https://docs.rs/wasm-snip\"\u003e\u003cimg src=\"https://img.shields.io/badge/docs-latest-blue.svg?style=flat-square\" alt=\"docs.rs docs\" /\u003e\u003c/a\u003e\n  \u003c/p\u003e\n\n  \u003ch3\u003e\n    \u003ca href=\"https://docs.rs/wasm-snip\"\u003eAPI Docs\u003c/a\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://github.com/rustwasm/wasm-snip/blob/master/CONTRIBUTING.md\"\u003eContributing\u003c/a\u003e\n    \u003cspan\u003e | \u003c/span\u003e\n    \u003ca href=\"https://discordapp.com/channels/442252698964721669/443151097398296587\"\u003eChat\u003c/a\u003e\n  \u003c/h3\u003e\n\n  \u003csub\u003eBuilt with 🦀🕸 by \u003ca href=\"https://rustwasm.github.io/\"\u003eThe Rust and WebAssembly Working Group\u003c/a\u003e\u003c/sub\u003e\n\u003c/div\u003e\n\n## About\n\n\n`wasm-snip` replaces a WebAssembly function's body with an `unreachable`.\n\nMaybe you know that some function will never be called at runtime, but the\ncompiler can't prove that at compile time? Snip it! All the functions it\ntransitively called \u0026mdash; which weren't called by anything else and therefore\ncould also never be called at runtime \u0026mdash; will get removed too.\n\nVery helpful when shrinking the size of WebAssembly binaries!\n\nThis functionality relies on the \"name\" section being present in the `.wasm`\nfile, so build with debug symbols:\n\n```toml\n[profile.release]\ndebug = true\n```\n\n* [Executable](#executable)\n* [Library](#library)\n* [License](#license)\n* [Contributing](#contributing)\n\n### Executable\n\nTo install the `wasm-snip` executable, run\n\n```\n$ cargo install wasm-snip\n```\n\nYou can use `wasm-snip` to remove the `annoying_space_waster`\nfunction from `input.wasm` and put the new binary in `output.wasm` like this:\n\n```\n$ wasm-snip input.wasm -o output.wasm annoying_space_waster\n```\n\nFor information on using the `wasm-snip` executable, run\n\n```\n$ wasm-snip --help\n```\n\nAnd you'll get the most up-to-date help text, like:\n\n```\nReplace a wasm function with an `unreachable`.\n\nUSAGE:\nwasm-snip [FLAGS] [OPTIONS] \u003cinput\u003e [--] [function]...\n\nFLAGS:\n-h, --help                    Prints help information\n--snip-rust-fmt-code          Snip Rust's `std::fmt` and `core::fmt` code.\n--snip-rust-panicking-code    Snip Rust's `std::panicking` and `core::panicking` code.\n-V, --version                 Prints version information\n\nOPTIONS:\n-o, --output \u003coutput\u003e         The path to write the output wasm file to. Defaults to stdout.\n-p, --pattern \u003cpattern\u003e...    Snip any function that matches the given regular expression.\n\nARGS:\n\u003cinput\u003e          The input wasm file containing the function(s) to snip.\n\u003cfunction\u003e...    The specific function(s) to snip. These must match exactly. Use the -p flag for fuzzy matching.\n```\n\n### Library\n\nTo use `wasm-snip` as a library, add this to your `Cargo.toml`:\n\n```toml\n[dependencies.wasm-snip]\n# Do not build the executable.\ndefault-features = false\n```\n\nSee [docs.rs/wasm-snip][docs] for API documentation.\n\n[docs]: https://docs.rs/wasm-snip\n\n### License\n\nLicensed under either of\n\n * [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0)\n\n * [MIT license](http://opensource.org/licenses/MIT)\n\nat your option.\n\n### Contributing\n\nSee\n[CONTRIBUTING.md](https://github.com/rustwasm/wasm-snip/blob/master/CONTRIBUTING.md)\nfor hacking.\n\nUnless you explicitly state otherwise, any contribution intentionally submitted\nfor inclusion in the work by you, as defined in the Apache-2.0 license, shall be\ndual licensed as above, without any additional terms or conditions.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustwasm%2Fwasm-snip","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frustwasm%2Fwasm-snip","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frustwasm%2Fwasm-snip/lists"}