{"id":27918584,"url":"https://github.com/jsprismarine/jsbinaryutils","last_synced_at":"2025-07-06T03:35:10.429Z","repository":{"id":57122558,"uuid":"301847335","full_name":"JSPrismarine/JSBinaryUtils","owner":"JSPrismarine","description":"A TypeScript / JavaScript library for managing buffers in a NodeJS app.","archived":false,"fork":false,"pushed_at":"2024-02-23T14:34:25.000Z","size":448,"stargazers_count":3,"open_issues_count":2,"forks_count":2,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-07-03T04:07:17.310Z","etag":null,"topics":["binary","binary-stream","hacktoberfest","node","npm"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/@jsprismarine/jsbinaryutils","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"HerryYT/JSBinaryUtils","license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JSPrismarine.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-10-06T20:31:03.000Z","updated_at":"2023-09-15T20:03:28.000Z","dependencies_parsed_at":"2024-06-18T21:19:22.176Z","dependency_job_id":null,"html_url":"https://github.com/JSPrismarine/JSBinaryUtils","commit_stats":{"total_commits":59,"total_committers":5,"mean_commits":11.8,"dds":0.6101694915254237,"last_synced_commit":"0b078ab8abdfa66e76ff2b331d9dea953d5757ba"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/JSPrismarine/JSBinaryUtils","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSPrismarine%2FJSBinaryUtils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSPrismarine%2FJSBinaryUtils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSPrismarine%2FJSBinaryUtils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSPrismarine%2FJSBinaryUtils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JSPrismarine","download_url":"https://codeload.github.com/JSPrismarine/JSBinaryUtils/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JSPrismarine%2FJSBinaryUtils/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263844411,"owners_count":23518967,"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","binary-stream","hacktoberfest","node","npm"],"created_at":"2025-05-06T18:23:32.457Z","updated_at":"2025-07-06T03:35:10.408Z","avatar_url":"https://github.com/JSPrismarine.png","language":"TypeScript","readme":"[![npm](https://img.shields.io/npm/v/@jsprismarine/jsbinaryutils?style=flat-square)](https://www.npmjs.com/package/@jsprismarine/jsbinaryutils)\n[![Dependents (via libraries.io)](https://img.shields.io/librariesio/dependents/npm/@jsprismarine/jsbinaryutils?style=flat-square)](#)\n![npm](https://img.shields.io/npm/dw/@jsprismarine/jsbinaryutils?style=flat-square)\n\n# JSBinaryUtils\nA TypeScript / JavaScript library for managing buffers in a NodeJS app.\nThis library has been created to solve the big overhead of resources usage when a project needs to write some new data very often in the same Buffer instance (Buffer.concat will create new Buffers, so it's really bad for the performance of real time applications, and that is why JSBinaryUtils was created).\n\n:warning: This guide is incomplete, please help by contributing! thank you :)\n\n- [JSBinaryUtils](#jsbinaryutils)\n\t- [Installation](#installation)\n- [API](#api)\n\t- [Reading](#reading)\n\t\t- [read(len: number)](#read)\n\t\t- [readByte()](#readbyte)\n\t\t- [readSignedByte()](#readsbyte)\n\t\t- [readBoolean()](#readboolean)\n\t\t- [readShort()](#readshort)\n\t\t- [readShortLE()](#readshortle)\n\t\t- [readUnsignedShort()](#readushort)\n\t\t- [readUnsignedShortLE()](#readushortle)\n\t\t- [readTriad()](#readtriad)\n\t- [Writing](#writing)\n\t\t- [write(buffer: Uint8Array | Buffer)](#write)\n\n## Installation\n\nInstall by `npm`\n\n```sh\nnpm install @jsprismarine/jsbinaryutils\n```\n\n**or** install with `yarn`\n\n```sh\nyarn add @jsprismarine/jsbinaryutils\n```\n\n# Api\n\nA BinaryStream instance can be used for reading or for writing but not both at the same time.\n\n## Reading\n\n### \u003ca name=\"read\"\u003e\u003c/a\u003eread(length: number)\n\nReads a slice of bytes in the buffer on the stream instance and returns it in a Buffer.\n\n### Usage\n\n```typescript\nimport BinaryStream from \"@jsprismarine/jsbinaryutils\";\n\nconst stream = new BinaryStream(Buffer.from([255, 255, 200, 2]));\nconsole.log(stream.read(4));  // Buffer \u003c 0xFF 0xFF 0xFF 0xC8 0x02 \u003e\n```\n\n### \u003ca name=\"readbyte\"\u003e\u003c/a\u003ereadByte()\n\nReads an unsigned byte from the buffer (0 to 255).\n\n### Usage\n\n```typescript\nimport BinaryStream from \"@jsprismarine/jsbinaryutils\";\n\nconst stream = new BinaryStream(Buffer.from([0xFF]));\nconsole.log(stream.readByte());  // 255\n```\n\n### \u003ca name=\"readsbyte\"\u003e\u003c/a\u003ereadSignedByte()\n\nReads a signed byte from the buffer (-128 to 127).\n\n### Usage\n\n```typescript\nimport BinaryStream from \"@jsprismarine/jsbinaryutils\";\n\nconst stream = new BinaryStream(Buffer.from([0x7F]));\nconsole.log(stream.readSignedByte());  // 127\n```\n\n### \u003ca name=\"readboolean\"\u003e\u003c/a\u003ereadBoolean()\n\nReads a boolean (1 byte, either true or false).\nEverything that is not 0x00 is true.\n\n### Usage\n\n```typescript\nimport BinaryStream from \"@jsprismarine/jsbinaryutils\";\n\nconst stream = new BinaryStream(Buffer.from([0x01]));\nconsole.log(stream.readBoolean());  // true\n```\n\n### \u003ca name=\"readshort\"\u003e\u003c/a\u003ereadShort()\n\nReads a signed big-endian short (2 bytes).\n\n### \u003ca name=\"readshortle\"\u003e\u003c/a\u003ereadShortLE()\n\nReads a signed little-endian short (2 bytes).\n\n### \u003ca name=\"readushort\"\u003e\u003c/a\u003ereadUnsignedShort()\n\nReads an unsigned big-endian short (2 bytes).\n\n### \u003ca name=\"readushortle\"\u003e\u003c/a\u003ereadUnsignedShortLE()\n\nReads an unsigned little-endian short (2 bytes).\n\n### \u003ca name=\"readtriad\"\u003e\u003c/a\u003ereadTriad()\n\nReads a big-endian triad (3 bytes).\n\n### \u003ca name=\"readtriadle\"\u003e\u003c/a\u003ereadTriadLE()\n\nReads a little-endian triad (3 bytes).\n\n### \u003ca name=\"readutriad\"\u003e\u003c/a\u003ereadUnsignedTriad()\n\nReads an unsigned big-endian triad (3 bytes).\n\n### \u003ca name=\"readutriadle\"\u003e\u003c/a\u003ereadUnsignedTriadLE()\n\nReads an unsigned little-endian triad (3 bytes).\n\n### \u003ca name=\"readint\"\u003e\u003c/a\u003ereadInt()\n\nReads a signed big-endian integer (1 byte, 0 to 255).\n\ntodo...\n\n## Writing\n\n### \u003ca name=\"write\"\u003e\u003c/a\u003ewrite(buffer: Uint8Array | Buffer)\n\nConcatenates the given buffer with the stream instance one.\n\n### Usage\n\n```typescript\nimport BinaryStream from \"@jsprismarine/jsbinaryutils\";\n\nconst stream = new BinaryStream();\nstream.write(Buffer.from([255, 255, 200, 2]));\nconsole.log(stream.getBuffer());  // Buffer \u003c 0xFF 0xFF 0xFF 0xC8 0x02 \u003e\n```\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsprismarine%2Fjsbinaryutils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjsprismarine%2Fjsbinaryutils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjsprismarine%2Fjsbinaryutils/lists"}