{"id":13523846,"url":"https://github.com/wasm-forge/wasi2ic","last_synced_at":"2025-04-01T01:33:38.050Z","repository":{"id":158810708,"uuid":"597744597","full_name":"wasm-forge/wasi2ic","owner":"wasm-forge","description":"WASI dependency replacer for the *.wasm files ","archived":false,"fork":false,"pushed_at":"2025-03-28T21:21:21.000Z","size":87,"stargazers_count":28,"open_issues_count":1,"forks_count":4,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-03-28T22:24:46.297Z","etag":null,"topics":["infrastructure","internet-computer","polyfill","tools","wasi"],"latest_commit_sha":null,"homepage":"","language":"Rust","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/wasm-forge.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2023-02-05T14:13:21.000Z","updated_at":"2025-03-28T21:20:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"4132b76e-e553-4ccb-b685-eb0f369d2f00","html_url":"https://github.com/wasm-forge/wasi2ic","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasm-forge%2Fwasi2ic","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasm-forge%2Fwasi2ic/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasm-forge%2Fwasi2ic/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/wasm-forge%2Fwasi2ic/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/wasm-forge","download_url":"https://codeload.github.com/wasm-forge/wasi2ic/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246567375,"owners_count":20798161,"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":["infrastructure","internet-computer","polyfill","tools","wasi"],"created_at":"2024-08-01T06:01:04.374Z","updated_at":"2025-04-01T01:33:33.034Z","avatar_url":"https://github.com/wasm-forge.png","language":"Rust","funding_links":[],"categories":["Developer Tooling"],"sub_categories":["Moonbit"],"readme":"\n\n\n## wasi2ic: WASI Polyfill Tool\n\n![Tests](https://github.com/wasm-forge/wasi2ic/actions/workflows/rust.yml/badge.svg?event=push)\n[![Coverage](https://codecov.io/gh/wasm-forge/wasi2ic/graph/badge.svg?token=XE48Z6JSYS)](https://codecov.io/gh/wasm-forge/wasi2ic)\n\n`wasi2ic` is a command-line tool that replaces WebAssembly System Interface (WASI) specific function calls with their \ncorresponding polyfill implementations. This allows you to run Wasm binaries compiled for `wasm32-wasi` on the Internet \nComputer.\n\n## Installation\n\nInstall `wasi2ic` using Cargo:\n\n```bash\ncargo install wasi2ic\n```\n\n## Usage\n\nReplace WASI dependencies in a Wasm file using:\n\n```bash\nwasi2ic \u003cinput-wasm-file\u003e \u003coutput_wasm_file\u003e\n```\n\nThis command reads the input Wasm file, removes WASI dependencies, and reroutes WASI calls to their IC-specific \nimplementations. Note that the polyfill implementation must be present in your Wasm binary.\n\nTo include the polyfill implementation in your Canister project, add the ic-wasi-polyfill dependency in it:\n```bash\ncargo add ic-wasi-polyfill\n```\n\nAlso you will need to add the initialization call to the polyfill library, basic example featuring user memory manager:\n\n```rust\nuse ic_stable_structures::{memory_manager::MemoryManager, DefaultMemoryImpl};\nuse std::cell::RefCell;\n\nthread_local! {\n    static MEMORY_MANAGER: RefCell\u003cMemoryManager\u003cDefaultMemoryImpl\u003e\u003e =\n        RefCell::new(MemoryManager::init(DefaultMemoryImpl::default()));\n}\n\n#[ic_cdk::init]\nfn init() {\n    MEMORY_MANAGER.with(|m| {\n        let m = m.borrow();\n        ic_wasi_polyfill::init_with_memory_manager(\u0026[0u8; 32], \u0026[], \u0026m, 200..210);\n    });\n}\n```\n\n\nFor more detailed information, see our [examples repository](https://github.com/wasm-forge/examples).\n\n\n## Related repositories\n\n\n| Repository                                    |  Description                  | \n| --------------------------------------------- | ----------------------------- |\n| [ic-wasi-polyfill](https://github.com/wasm-forge/ic-wasi-polyfill) | Polyfill library implementing the low-level WASI calls. |\n| [stable-fs](https://github.com/wasm-forge/stable-fs) | Simple file system implementation based on the stable structures. The file system implements backend for the ic-wasi-polyfill |\n| [examples](https://github.com/wasm-forge/examples) | Repository containing various examplpes of running WASI projects on the IC. |\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasm-forge%2Fwasi2ic","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwasm-forge%2Fwasi2ic","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwasm-forge%2Fwasi2ic/lists"}