{"id":34514121,"url":"https://github.com/koykov/bytebuf","last_synced_at":"2025-12-24T04:18:15.559Z","repository":{"id":57628023,"uuid":"403381759","full_name":"koykov/bytebuf","owner":"koykov","description":"Collection of various byte buffer implementations.","archived":false,"fork":false,"pushed_at":"2025-11-04T20:50:26.000Z","size":92,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-11-04T22:22:05.593Z","etag":null,"topics":["buffer","bytebuffer"],"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/koykov.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2021-09-05T18:17:10.000Z","updated_at":"2025-11-04T20:50:31.000Z","dependencies_parsed_at":"2023-01-31T16:15:50.446Z","dependency_job_id":"fa6209b1-db64-4d38-9d46-4ff3290aa0e1","html_url":"https://github.com/koykov/bytebuf","commit_stats":null,"previous_names":[],"tags_count":11,"template":false,"template_full_name":null,"purl":"pkg:github/koykov/bytebuf","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koykov%2Fbytebuf","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koykov%2Fbytebuf/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koykov%2Fbytebuf/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koykov%2Fbytebuf/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/koykov","download_url":"https://codeload.github.com/koykov/bytebuf/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/koykov%2Fbytebuf/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":27994565,"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","status":"online","status_checked_at":"2025-12-24T02:00:07.193Z","response_time":83,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["buffer","bytebuffer"],"created_at":"2025-12-24T04:18:14.897Z","updated_at":"2025-12-24T04:18:15.538Z","avatar_url":"https://github.com/koykov.png","language":"Go","readme":"# Byte buffers\n\nCollection of various byte buffer implementations.\n\n## Chain buffer\n\nA wrapper around `[]byte` slice that supports chain write methods. Example of usage:\n```go\nimport \"github.com/koykov/bytebuf\"\n\nvar buf bytebuf.Chain\nb := buf.Write([]byte(\"foo\")).\n    WriteString(\"bar\").\n    WriteByte('@').\n    WriteInt(-123).\n    WriteUint(123).\n    WriteFloat(3.1415).\n    WriteBool(true).\n    WriteRune('X').\n    WriteFormat(\"pre%dpost\", 15)\n    WriteX(1.23456).\n    Bytes()\nprintln(string(b)) // foobar@-1231233.1415trueXpre15post1.23456\n```\n\nThe same operations may be proceeded using `append()`/`AppendInt()`/... functions around `[]byte` slice, but `Chain`\nprovides handy API for that.\n\nChain buffer may be reused using internal pool. To get instance of the buffer from the pool call `AcquireChain` function.\nTo put buffer back to the pool call `ReleaseChain` function.\n\n## Accumulative buffer\n\nA wrapper around `Chain` buffer with \"staked\" features. The main idea is to accumulate (bufferize) various data and\nprovide handy access to chunks of buffered data. Example of usage:\n```go\nimport \"github.com/koykov/bytebuf\"\n\nvar (\n    buf bytebuf.Chain\n    msg protobuf.ExampleMessage\n)\nchunk0 := buf.WriteMarshallerTo(\u0026msg).Bytes()\nchunk1 := buf.StakeOut().Write([]byte(\"foo\")).\n    WriteString(\"bar\").\n    WriteByte('@').\n    WriteInt(-123).\n    WriteUint(123).\n    WriteFloat(3.1415).\n    WriteBool(true).\n    WriteRune('X').\n    WriteFormat(\"pre%dpost\", 15)\n    WriteX(1.23456).\n    StakedBytes()\nprintln(string(chunk0)) // h��\b�\u0001��,�\u0001�\b�\u0001�?�\u0001ihttps\nprintln(string(chunk1)) // foobar@-1231233.1415trueXpre15post1.23456\n```\nThus, one buffer may be used to bufferize multiple data and hence reduce pointers in application.\n\nAccumulative buffer may be reused using internal pool. To get instance of the buffer from the pool call `AcquireAccumulative`\nfunction. To put buffer back to the pool call `ReleaseAccumulative` function.\n\n# Pools\n\nBoth `Chain` and `Accumulative` buffers are using internal pools to reduce memory allocations.\n\nUsage:\n```go\ncbuf := bytebuf.AcquireChain()\ndefer bytebuf.ReleaseChain(cbuf)\ncbuf.WriteString(\"foo\")\n...\n\nabuf := bytebuf.AcquireAccumulative()\ndefer bytebuf.ReleaseAccumulative(abuf)\nabuf.WriteString(\"foo\")\n...\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoykov%2Fbytebuf","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkoykov%2Fbytebuf","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkoykov%2Fbytebuf/lists"}