{"id":13601411,"url":"https://github.com/akupila/go-wasm","last_synced_at":"2025-07-20T20:37:18.482Z","repository":{"id":46330450,"uuid":"142137057","full_name":"akupila/go-wasm","owner":"akupila","description":"WebAssembly binary file parser written in go","archived":false,"fork":false,"pushed_at":"2021-10-30T16:01:06.000Z","size":1320,"stargazers_count":132,"open_issues_count":5,"forks_count":11,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-07-05T04:44:06.792Z","etag":null,"topics":["binary","go","golang","parser","wasm"],"latest_commit_sha":null,"homepage":"","language":"Go","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/akupila.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}},"created_at":"2018-07-24T09:35:43.000Z","updated_at":"2024-09-09T22:16:04.000Z","dependencies_parsed_at":"2022-09-19T14:43:10.690Z","dependency_job_id":null,"html_url":"https://github.com/akupila/go-wasm","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/akupila/go-wasm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akupila%2Fgo-wasm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akupila%2Fgo-wasm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akupila%2Fgo-wasm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akupila%2Fgo-wasm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/akupila","download_url":"https://codeload.github.com/akupila/go-wasm/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/akupila%2Fgo-wasm/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":266195267,"owners_count":23891163,"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":["binary","go","golang","parser","wasm"],"created_at":"2024-08-01T18:01:02.404Z","updated_at":"2025-07-20T20:37:18.455Z","avatar_url":"https://github.com/akupila.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/akupila/go-wasm.svg?style=svg)](https://circleci.com/gh/akupila/go-wasm)\n[![godoc](https://img.shields.io/badge/godoc-Reference-brightgreen.svg?style=flat)](https://godoc.org/github.com/akupila/go-wasm)\n\n# go-wasm\n\nA WebAssembly binary file parser in go.\n\nThe parser takes an `io.Reader` and parses a WebAssembly module from it, which\nallows the user to see into the binary file. All data is read, future version\nmay allow to write it out too, which would allow modifying the binary.\n\nFor example:\n\n```go\npackage main\n\nimport (\n\t\"flag\"\n\t\"fmt\"\n\t\"os\"\n\t\"text/tabwriter\"\n\n\twasm \"github.com/akupila/go-wasm\"\n)\n\nfunc main() {\n\tfile := flag.String(\"file\", \"\", \"file to parse (.wasm)\")\n\tflag.Parse()\n\n\tif *file == \"\" {\n\t\tflag.Usage()\n\t\tos.Exit(2)\n\t}\n\n\tf, err := os.Open(*file)\n\tif err != nil {\n\t\tfmt.Fprintf(os.Stderr, \"open file: %v\", err)\n\t\tos.Exit(1)\n\t}\n\tdefer f.Close()\n\n\tmod, err := wasm.Parse(f)\n\tif err != nil {\n\t\tfmt.Fprintln(os.Stderr, err)\n\t\tos.Exit(1)\n\t}\n\n\tw := tabwriter.NewWriter(os.Stdout, 0, 0, 4, ' ', 0)\n\tfmt.Fprintf(w, \"Index\\tName\\tSize (bytes)\\n\")\n\tfor i, s := range mod.Sections {\n\t\tfmt.Fprintf(w, \"%d\\t%s\\t%d\\n\", i, s.Name(), s.Size())\n\t}\n\tw.Flush()\n}\n```\n\n_when passed in a `.wasm` file compiled with go1.11:_\n\n```\nIndex    Name        Size (bytes)\n0        Custom      103\n1        Type        58\n2        Import      363\n3        Function    1588\n4        Table       5\n5        Memory      5\n6        Global      51\n7        Export      14\n8        Element     3066\n9        Code        1174891\n10       Data        1169054\n11       Custom      45428\n```\n\n**Much** more information is available by type asserting on the items in\n`.Sections`, for example:\n\n```go\nfor i, s := range mod.Sections {\n    switch section := s.(type) {\n        case *wasm.SectionCode:\n            // can now read function bytecode from section.\n    }\n}\n```\n\n## Installation\n\n```\ngo get github.com/akupila/go-wasm/...\n```\n\n## Notes\n\nThis is a experimental, early and definitely not properly tested. There are\nprobably bugs. If you find one, please open an issue!\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakupila%2Fgo-wasm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fakupila%2Fgo-wasm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fakupila%2Fgo-wasm/lists"}