{"id":22243336,"url":"https://github.com/galaco/bitbuf","last_synced_at":"2025-03-25T10:43:55.852Z","repository":{"id":57482858,"uuid":"155908231","full_name":"Galaco/bitbuf","owner":"Galaco","description":"A simple Go Read \u0026 Write bitstream","archived":false,"fork":false,"pushed_at":"2021-04-20T12:24:00.000Z","size":11,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-01-30T09:44:20.870Z","etag":null,"topics":["bitstream","buffer","compression","parser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Galaco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-11-02T18:43:43.000Z","updated_at":"2022-10-14T22:26:16.000Z","dependencies_parsed_at":"2022-09-04T04:01:55.150Z","dependency_job_id":null,"html_url":"https://github.com/Galaco/bitbuf","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/Galaco%2Fbitbuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Galaco%2Fbitbuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Galaco%2Fbitbuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Galaco%2Fbitbuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Galaco","download_url":"https://codeload.github.com/Galaco/bitbuf/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245449532,"owners_count":20617187,"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":["bitstream","buffer","compression","parser"],"created_at":"2024-12-03T04:26:00.965Z","updated_at":"2025-03-25T10:43:55.815Z","avatar_url":"https://github.com/Galaco.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GoDoc](https://godoc.org/github.com/Galaco/bitbuf?status.svg)](https://godoc.org/github.com/Galaco/bitbuf)\n[![Go report card](https://goreportcard.com/badge/github.com/galaco/bitbuf)](https://goreportcard.com/badge/github.com/galaco/bitbuf)\n[![Build Status](https://travis-ci.com/Galaco/bitbuf.svg?branch=master)](https://travis-ci.com/Galaco/bitbuf)\n\n# bitbuf\n\nA readable bitstream. Create from a byte slice, and read through the stream\nbit by bit.\n\nSupports the following read types:\n* `byte`, `[]byte`\n* `int8`, `int16`, `int32`, `int64`\n* `uint8`, `uint16`, `uint32`, `uint64`\n* `float32`, `float64`\n* `string` (of known length, or until null terminator)\n* `bits` (returned as `[]byte`\n\n\n### Usage\n```go\npackage main\n\nimport (\n\t\"bytes\"\n\t\"encoding/binary\"\n\t\"github.com/galaco/bitbuf\"\n\t\"log\"\n)\n\ntype Foo struct {\n\tA byte\n\tB int16\n\tC float32\n\tD int64\n\tE [32]byte\n\tF uint8\n\tG float64\n\tH int8\n\tI uint32\n}\n\nfunc main() {\n\tdataBuffer := \u0026bytes.Buffer{}\n\tf := Foo{\n\t\tA: 32,\n\t\tB: 8375,\n\t\tC: 2106.3212345,\n\t\tD: 5635455352,\n\t\tE: [32]byte{84,12,1,2,3,4,5,6,7,8,9,0,1,2,3,4,5,6,7,8,9,0,12,13,54,1,143,234,5,56,1,2},\n\t\tF: 213,\n\t\tG: -756351.123,\n\t\tH: -57,\n\t\tI: 12645123,\n\t}\n\n\tbinary.Write(dataBuffer, binary.LittleEndian, f)\n\n\tbuf := bitbuf.NewReader(dataBuffer.Bytes())\n\tlog.Println(buf.ReadByte())\n\tlog.Println(buf.ReadInt16())\n\tlog.Println(buf.ReadFloat32())\n\tlog.Println(buf.ReadInt64())\n\tlog.Println(buf.ReadBytes(32))\n\tlog.Println(buf.ReadUint8())\n\tlog.Println(buf.ReadFloat64())\n\tlog.Println(buf.ReadInt8())\n\tlog.Println(buf.ReadUint32())\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalaco%2Fbitbuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgalaco%2Fbitbuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgalaco%2Fbitbuf/lists"}