{"id":18446709,"url":"https://github.com/cristalhq/bencode","last_synced_at":"2025-04-08T00:31:57.015Z","repository":{"id":35031179,"uuid":"193142695","full_name":"cristalhq/bencode","owner":"cristalhq","description":"Bencode encoding and decoding in Go.","archived":false,"fork":false,"pushed_at":"2024-03-08T10:29:11.000Z","size":60,"stargazers_count":10,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-01T23:17:11.767Z","etag":null,"topics":["bencode","bencode-parser","bittorrent","codec","decoder","dependency-free","deserialization","encoder","go","golang","serialization","torrent"],"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/cristalhq.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}},"created_at":"2019-06-21T18:21:45.000Z","updated_at":"2025-03-18T16:31:24.000Z","dependencies_parsed_at":"2023-12-17T11:32:48.932Z","dependency_job_id":"3838bcfd-f5fb-478d-8cca-f5f09415cd8c","html_url":"https://github.com/cristalhq/bencode","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbencode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbencode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbencode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cristalhq%2Fbencode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cristalhq","download_url":"https://codeload.github.com/cristalhq/bencode/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247755407,"owners_count":20990617,"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":["bencode","bencode-parser","bittorrent","codec","decoder","dependency-free","deserialization","encoder","go","golang","serialization","torrent"],"created_at":"2024-11-06T07:10:20.187Z","updated_at":"2025-04-08T00:31:56.696Z","avatar_url":"https://github.com/cristalhq.png","language":"Go","readme":"# bencode\n\n[![build-img]][build-url]\n[![pkg-img]][pkg-url]\n[![version-img]][version-url]\n\nPackage implements Bencode encoding and decoding in Go.\n\n## Features\n\n* Simple API.\n* Clean and tested code.\n* Optimized for speed.\n* Dependency-free.\n\nSee [docs][pkg-url].\n\n## Install\n\nGo version 1.18+\n\n```\ngo get github.com/cristalhq/bencode\n```\n\n## Example\n\nMarshaling into Bencode\n\n```go\n// data to process, most of the types are supported\nvar data any = map[string]any{\n    \"1\":     42,\n    \"hello\": \"world\",\n    \"foo\":   []string{\"bar\", \"baz\"},\n}\n\nbuf, err := bencode.Marshal(data)\ncheckErr(err)\nfmt.Printf(\"marshaled: %s\\n\", string(buf))\n\n// or via Encoder:\nw := \u0026bytes.Buffer{} // or any other io.Writer\nerr = bencode.NewEncoder(w).Encode(data)\ncheckErr(err)\n\n// Output:\n// marshaled: d1:1i42e3:fool3:bar3:baze5:hello5:worlde\n```\n\nUnmarshaling from Bencode\n\n```go\nvar data any\n\nbuf := []byte(\"li1ei42ee\")\n\nerr := bencode.Unmarshal(buf, \u0026data)\ncheckErr(err)\n\n// or via Decoder:\nr := bytes.NewBufferString(\"li1ei42ee\") // or any other io.Reader\nerr = bencode.NewDecoder(r).Decode(\u0026data)\ncheckErr(err)\n\nfmt.Printf(\"unmarshaled: %v\\n\", data)\n\n// Output:\n// unmarshaled: [1 42]\n```\n\nSee examples: [example_test.go](example_test.go).\n\n## License\n\n[MIT License](LICENSE).\n\n[build-img]: https://github.com/cristalhq/bencode/workflows/build/badge.svg\n[build-url]: https://github.com/cristalhq/bencode/actions\n[pkg-img]: https://pkg.go.dev/badge/cristalhq/bencode\n[pkg-url]: https://pkg.go.dev/github.com/cristalhq/bencode\n[version-img]: https://img.shields.io/github/v/release/cristalhq/bencode\n[version-url]: https://github.com/cristalhq/bencode/releases\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fbencode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcristalhq%2Fbencode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcristalhq%2Fbencode/lists"}