{"id":15449169,"url":"https://github.com/hazae41/binary","last_synced_at":"2025-07-14T06:02:43.518Z","repository":{"id":65722853,"uuid":"578629516","full_name":"hazae41/binary","owner":"hazae41","description":"Zero-copy binary data types 🏎️","archived":false,"fork":false,"pushed_at":"2025-06-30T09:26:22.000Z","size":317,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-06-30T09:34:44.965Z","etag":null,"topics":["binary","buffer","cursor","decoding","encoding","esmodules","javascript","nodejs","typescript","unit-testing","zero-copy"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","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/hazae41.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":null,"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},"funding":{"github":["hazae41"],"patreon":"hazae41"}},"created_at":"2022-12-15T14:05:49.000Z","updated_at":"2025-06-30T09:26:26.000Z","dependencies_parsed_at":"2024-06-21T03:07:07.504Z","dependency_job_id":"e3ebc748-2492-4b55-b41d-4e63e87411ce","html_url":"https://github.com/hazae41/binary","commit_stats":{"total_commits":68,"total_committers":1,"mean_commits":68.0,"dds":0.0,"last_synced_commit":"35247eb0df86b7033c990e1da66015913a36e5c6"},"previous_names":[],"tags_count":53,"template":false,"template_full_name":null,"purl":"pkg:github/hazae41/binary","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fbinary","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fbinary/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fbinary/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fbinary/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hazae41","download_url":"https://codeload.github.com/hazae41/binary/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hazae41%2Fbinary/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":265248557,"owners_count":23734258,"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":["binary","buffer","cursor","decoding","encoding","esmodules","javascript","nodejs","typescript","unit-testing","zero-copy"],"created_at":"2024-10-01T20:43:38.030Z","updated_at":"2025-07-14T06:02:43.510Z","avatar_url":"https://github.com/hazae41.png","language":"TypeScript","readme":"\u003cdiv align=\"center\"\u003e\n\u003cimg src=\"https://user-images.githubusercontent.com/4405263/219944821-62f41f78-522b-4d10-92fb-923ae6c36602.png\" /\u003e\n\u003c/div\u003e\n\n```bash\nnpm i @hazae41/binary\n```\n\n[**Node Package 📦**](https://www.npmjs.com/package/@hazae41/binary)\n\n## Features\n\n### Current features\n- 100% TypeScript and ESM\n- No external dependencies\n- Zero-copy reading and writing\n- Rust-like patterns\n- Unit-tested\n\n## Usage\n\n#### Writable\n\n```typescript\nclass MyObject implements Writable {\n\n  constructor(\n    readonly x: number,\n    readonly y: number\n  ) {}\n\n  sizeOrThrow() {\n    return 1 + 2\n  }\n\n  writeOrThrow(cursor: Cursor) {\n    cursor.writeUint8OrThrow(this.x)\n    cursor.writeUint16OrThrow(this.y)\n  }\n\n}\n```\n\n```typescript\nconst myobject = new MyObject(1, 515)\nconst bytes = Writable.writeToBytesOrThrow(myobject) // Uint8Array([1, 2, 3])\n```\n\n#### Readable\n\n```typescript\nclass MyObject {\n\n  constructor(\n    readonly x: number,\n    readonly y: number\n  ) {}\n\n  static readOrThrow(cursor: Cursor): MyObject {\n    const x = cursor.readUint8OrThrow()\n    const y = cursor.readUint16OrThrow()\n\n    return new MyObject(x, y)\n  }\n\n}\n```\n\n```typescript\nconst bytes = new Uint8Array([1, 2, 3])\nconst myobject = Readable.readFromBytesOrThrow(MyObject, bytes) // MyObject(1, 515)\n```\n\n#### Opaque\n\nThis is a binary data type that just holds bytes, it can be used when a binary data type is required\n\n```typescript\nconst bytes = new Uint8Array([1, 2, 3])\nconst opaque = Readable.readFromBytesOrThrow(Opaque.Uncopied, bytes) // Opaque(Uint8Array([1, 2, 3]))\nconst myobject = opaque.readIntoOrThrow(MyObject) // MyObject(1, 515)\n```\n\n```typescript\nconst myobject = new MyObject(1, 515)\nconst opaque = Opaque.writeFromOrThrow(myobject) // Opaque.Copied(Uint8Array([1, 2, 3]))\nconst bytes = Writable.writeToBytesOrThrow(opaque) // Uint8Array([1, 2, 3])\n```\n","funding_links":["https://github.com/sponsors/hazae41","https://patreon.com/hazae41"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazae41%2Fbinary","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhazae41%2Fbinary","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhazae41%2Fbinary/lists"}