{"id":21992616,"url":"https://github.com/beeequeue/binary-util","last_synced_at":"2025-08-24T09:41:37.908Z","repository":{"id":255438273,"uuid":"850219067","full_name":"beeequeue/binary-util","owner":"beeequeue","description":"A utility library for working with binary data.","archived":false,"fork":false,"pushed_at":"2025-01-10T21:59:32.000Z","size":114,"stargazers_count":0,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-10T22:42:10.554Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/beeequeue.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","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":"2024-08-31T07:12:03.000Z","updated_at":"2025-01-07T20:18:55.000Z","dependencies_parsed_at":null,"dependency_job_id":"66c00202-36fb-422e-947f-f3061071e4fa","html_url":"https://github.com/beeequeue/binary-util","commit_stats":null,"previous_names":["beeequeue/binary-util"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeequeue%2Fbinary-util","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeequeue%2Fbinary-util/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeequeue%2Fbinary-util/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/beeequeue%2Fbinary-util/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/beeequeue","download_url":"https://codeload.github.com/beeequeue/binary-util/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234455934,"owners_count":18835665,"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-11-29T20:14:18.576Z","updated_at":"2025-01-18T02:53:04.214Z","avatar_url":"https://github.com/beeequeue.png","language":"TypeScript","readme":"# binary-util\n\n[![npm](https://img.shields.io/npm/v/binary-util)](https://www.npmjs.com/package/binary-util)\n![npm bundle size](https://deno.bundlejs.com/?q=binary-util\u0026badge)\n![node-current](https://img.shields.io/node/v/binary-util)\n\nA utility library for working with binary data in.\n\nIt does not have full support for all types of data, but it does have the ones I needed.\n\n## Usage\n\nA full example of how to use this library can be found in my [RE MSG library](https://github.com/beeequeue/remsg).\n\nHere are some non-exhaustive examples:\n\n### Decoder\n\n```typescript\nimport { Decoder } from \"binary-util\"\n\nconst data = Buffer.from([\n  0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x2c, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21,\n])\nconst decoder = new Decoder(data)\n\n// You can use it to just read data straight from the buffer\ndecoder.readString({ length: 5 }) // Hello\ndecoder.readString({ length: 7 }) // \", World\"\n\n// Utilities\nencoder.seek(-1)\nencoder.seek(1)\nencoder.alignTo(8)\n\n// Or you can use it more ergonomically when possible\nconst decoder2 = new Decoder(Buffer.alloc(2, 2))\nconst result = {\n  a: decoder2.readUint8(), // 2\n  b: decoder2.readUint8(), // 2\n}\n```\n\n### Encoder\n\n```typescript\nimport { Encoder } from \"binary-util\"\n\nconst encoder = new Encoder()\n\nencoder.writeString(\"Hello, World\")\nencoder.seek(-1)\nencoder.seek(1)\nencoder.alignTo(8)\nencoder.writeUint8(2)\n\nencoder.goto(1)\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeeequeue%2Fbinary-util","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbeeequeue%2Fbinary-util","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbeeequeue%2Fbinary-util/lists"}