{"id":22608048,"url":"https://github.com/jcalabro/leb128","last_synced_at":"2026-04-28T20:32:10.300Z","repository":{"id":60844082,"uuid":"544033987","full_name":"jcalabro/leb128","owner":"jcalabro","description":"Go implementation of signed/unsigned LEB128","archived":false,"fork":false,"pushed_at":"2023-09-17T01:32:28.000Z","size":19,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-25T20:30:00.923Z","etag":null,"topics":["dwarf","go","golang","leb128","wasm"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/jcalabro/leb128","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/jcalabro.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":"2022-10-01T13:17:26.000Z","updated_at":"2023-01-22T19:47:49.000Z","dependencies_parsed_at":"2024-06-21T02:09:43.476Z","dependency_job_id":"4cd84964-1e49-4544-ae81-00c573866b1b","html_url":"https://github.com/jcalabro/leb128","commit_stats":{"total_commits":9,"total_committers":1,"mean_commits":9.0,"dds":0.0,"last_synced_commit":"6e4bdcdbf18ef3c64471126a6093260826cdfac4"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcalabro%2Fleb128","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcalabro%2Fleb128/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcalabro%2Fleb128/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jcalabro%2Fleb128/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jcalabro","download_url":"https://codeload.github.com/jcalabro/leb128/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246107937,"owners_count":20724630,"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":["dwarf","go","golang","leb128","wasm"],"created_at":"2024-12-08T14:26:35.828Z","updated_at":"2026-04-28T20:32:05.281Z","avatar_url":"https://github.com/jcalabro.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# leb128\n\n[![GoDoc](https://pkg.go.dev/badge/github.com/jcalabro/leb128?status.svg)](https://pkg.go.dev/github.com/jcalabro/leb128) [![Tests](https://github.com/jcalabro/leb128/actions/workflows/ci.yaml/badge.svg)](https://github.com/jcalabro/leb128/actions/workflows/ci.yaml) [![codecov](https://codecov.io/github/jcalabro/leb128/branch/main/graph/badge.svg?token=ILKTKORT5D)](https://codecov.io/github/jcalabro/leb128)\n\nGo implementation of signed/unsigned LEB128. Encodes/decodes 8 byte integers.\n\n## Usage\n\nFull documentation is available at [gopkg.dev](https://pkg.go.dev/github.com/jcalabro/leb128).\n\n#### Decoding\n\nRead from an `io.Reader` in to an `int64` or `uint64`:\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\n\t\"github.com/jcalabro/leb128\"\n)\n\nfunc unsigned() {\n\t// using a buffer of length \u003e10 in either the signed/unsigned case\n\t// will return the error leb128.ErrOverflow\n\n\tbuf := bytes.NewBuffer([]byte{128, 2})\n\tnum, err := leb128.DecodeU64(buf)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(num) // 256\n}\n\nfunc signed() {\n\tbuf := bytes.NewBuffer([]byte{128, 126})\n\tnum, err := leb128.DecodeS64(buf)\n\tif err != nil {\n\t\tpanic(err)\n\t}\n\tfmt.Println(num) // -256\n}\n\nfunc main() {\n\tunsigned()\n\tsigned()\n}\n```\n\n#### Encoding\n\nConvert an `int64` or `uint64` to a `[]byte`:\n\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"fmt\"\n\n\t\"github.com/jcalabro/leb128\"\n)\n\nfunc unsigned() {\n\tbuf := leb128.EncodeU64(256)\n\tfmt.Println(buf) // [128 2]\n}\n\nfunc signed() {\n\tbuf := leb128.EncodeS64(-256)\n\tfmt.Println(buf) // [128 126]\n}\n\nfunc main() {\n\tunsigned()\n\tsigned()\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcalabro%2Fleb128","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjcalabro%2Fleb128","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjcalabro%2Fleb128/lists"}