{"id":13730157,"url":"https://github.com/go-restruct/restruct","last_synced_at":"2025-05-08T02:31:31.078Z","repository":{"id":36586312,"uuid":"40892293","full_name":"go-restruct/restruct","owner":"go-restruct","description":"Rich binary (de)serialization library for Golang","archived":false,"fork":false,"pushed_at":"2022-03-31T02:39:25.000Z","size":165,"stargazers_count":351,"open_issues_count":22,"forks_count":17,"subscribers_count":9,"default_branch":"master","last_synced_at":"2024-08-04T02:09:20.937Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://restruct.io/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"isc","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/go-restruct.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-17T12:19:04.000Z","updated_at":"2024-08-02T15:07:02.000Z","dependencies_parsed_at":"2022-07-13T01:40:26.746Z","dependency_job_id":null,"html_url":"https://github.com/go-restruct/restruct","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-restruct%2Frestruct","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-restruct%2Frestruct/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-restruct%2Frestruct/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/go-restruct%2Frestruct/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/go-restruct","download_url":"https://codeload.github.com/go-restruct/restruct/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224689424,"owners_count":17353375,"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":[],"created_at":"2024-08-03T02:01:10.688Z","updated_at":"2024-11-14T20:31:56.514Z","avatar_url":"https://github.com/go-restruct.png","language":"Go","readme":"# restruct [![Go](https://github.com/jchv/cleansheets/actions/workflows/go.yml/badge.svg)](https://github.com/jchv/cleansheets/actions/workflows/go.yml) [![codecov.io](http://codecov.io/github/go-restruct/restruct/coverage.svg?branch=master)](http://codecov.io/github/go-restruct/restruct?branch=master) [![godoc.org](http://img.shields.io/badge/godoc-reference-5272B4.svg?style=flat-square)](https://godoc.org/github.com/go-restruct/restruct) [![Go Report Card](https://goreportcard.com/badge/github.com/go-restruct/restruct)](https://goreportcard.com/report/github.com/go-restruct/restruct)\n`restruct` is a library for reading and writing binary data in Go. Similar to\nlunixbochs `struc` and `encoding/binary`, this library reads data based on the\nlayout of structures and, like `struc`, based on what is contained in struct\ntags.\n\nTo install Restruct, use the following command:\n\n```\ngo get github.com/go-restruct/restruct\n```\n\n`restruct` aims to provide a clean, flexible, robust implementation of struct\npacking. In the future, through fast-path optimizations and code generation, it\nalso aims to be quick, but it is currently very slow.\n\n`restruct` currently requires Go 1.7+.\n\n## Status\n\n  * As of writing, coverage is hovering around 95%, but more thorough testing\n    is always useful and desirable.\n  * Unpacking and packing are fully functional.\n  * More optimizations are probably possible.\n\n## Example\n\n```go\npackage main\n\nimport (\n\t\"encoding/binary\"\n\t\"io/ioutil\"\n\t\"os\"\n\n\t\"github.com/go-restruct/restruct\"\n)\n\ntype Record struct {\n\tMessage string `struct:\"[128]byte\"`\n}\n\ntype Container struct {\n\tVersion   int `struct:\"int32\"`\n\tNumRecord int `struct:\"int32,sizeof=Records\"`\n\tRecords   []Record\n}\n\nfunc main() {\n\tvar c Container\n\n\tfile, _ := os.Open(\"records\")\n\tdefer file.Close()\n\tdata, _ := ioutil.ReadAll(file)\n\n\trestruct.Unpack(data, binary.LittleEndian, \u0026c)\n}\n```\n","funding_links":[],"categories":["Language specific libraries"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-restruct%2Frestruct","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgo-restruct%2Frestruct","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgo-restruct%2Frestruct/lists"}