{"id":15805291,"url":"https://github.com/k0lb3/binaryreader","last_synced_at":"2025-04-21T08:31:29.514Z","repository":{"id":57415090,"uuid":"434757019","full_name":"K0lb3/binaryreader","owner":"K0lb3","description":"a faster and more elegant alternative to struct for parsing binary data in Python","archived":false,"fork":false,"pushed_at":"2023-06-01T21:30:02.000Z","size":33,"stargazers_count":5,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-19T04:13:17.352Z","etag":null,"topics":["binary-data","parser-library","parsing","python","struct"],"latest_commit_sha":null,"homepage":"","language":"C","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/K0lb3.png","metadata":{"files":{"readme":"README.md","changelog":null,"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":"2021-12-03T23:07:19.000Z","updated_at":"2024-11-04T04:43:10.000Z","dependencies_parsed_at":"2024-10-26T16:21:23.852Z","dependency_job_id":null,"html_url":"https://github.com/K0lb3/binaryreader","commit_stats":{"total_commits":15,"total_committers":1,"mean_commits":15.0,"dds":0.0,"last_synced_commit":"848abd08369b736e80532992dfe3f603b856df26"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K0lb3%2Fbinaryreader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K0lb3%2Fbinaryreader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K0lb3%2Fbinaryreader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/K0lb3%2Fbinaryreader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/K0lb3","download_url":"https://codeload.github.com/K0lb3/binaryreader/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250023478,"owners_count":21362407,"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-data","parser-library","parsing","python","struct"],"created_at":"2024-10-05T02:07:56.731Z","updated_at":"2025-04-21T08:31:29.273Z","avatar_url":"https://github.com/K0lb3.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# binaryreader\n\nbinaryreader is a faster and more elegant alternative to ``struct`` for parsing binary data in Python.\n\n## Example\n\n```python\nfrom binaryreader import BinaryReader\n\ndata: bytes|bytearray\nread_little_endian: bool = True\nreader = BinaryReader(data, read_little_endian)\n\ntext = reader.readStringC()\n```\n\n## Benchmark\n\nTODO\n\n\n## Documentation\n\n### Notes:\n- kwargs won't be accepted, only args are useable\n- all readArray functions accept a langth as optional argument\n- bytes can be read by using readUInt8Array\n\n\n### Init\n- ``BinaryReader(data: bytes|bytearray, is_little_endian: bool)``\n\n### Properties\n\n- ``.endian: bool``\\[get,set\\] - endianness of the reader (True - little, False - big)\n- ``.position: int``\\[get,set\\] - position of the cursor within the data\n- ``.size: int``\\[get\\] - size of underlying/passed object\n- ``.obj: bytes|bytearray``\\[get\\] - underlying/passed object\n\n### Functions\n- ``.readBool(): bool`` - reads a bool\n- ``.readInt8(): int`` - reads an int8\n- ``.readUInt8(): int`` - reads an uint8\n- ``.readInt16(): int`` - reads an int16\n- ``.readUInt16(): int`` - reads an uint16\n- ``.readInt32(): int`` - reads an int32\n- ``.readUInt32(): int`` - reads an uint32\n- ``.readInt64(): int`` - reads an int64\n- ``.readUInt64(): int`` - reads an uint64\n- ``.readHalf(): float`` - reads a half\n- ``.readFloat(): float`` - reads a float\n- ``.readDouble(): float`` - reads a double\n- ``.readBoolArray(): [bool]`` - reads a bool array\n- ``.readInt8Array(): [int]`` - reads a array of int8\n- ``.readUInt8Array(): bytearray`` - reads a array of uint8\n- ``.readInt16Array(): [int]`` - reads a array of int16\n- ``.readUInt16Array(): [int]`` - reads a array of uint16\n- ``.readInt32Array(): [int]`` - reads a array of int32\n- ``.readUInt32Array(): [int]`` - reads a array of uint32\n- ``.readInt64Array(): [int]`` - reads a array of int64\n- ``.readUInt64Array(): [int]`` - reads a array of uint64\n- ``.readHalfArray(): [float]`` - reads a array of half\n- ``.readFloatArray(): [float]`` - reads a array of float\n- ``.readDoubleArray(): [float]`` - reads a array of double\n- ``.readStringC(): str`` - reads a null terminated string\n- ``.readStringCArray(): [str]`` - reads an array of null terminated strings\n- ``.readString(): str`` - reads a string (if length is not passed as arg, read an int as length)\n- ``.readStringArray(): [str]`` - reads an array of strings\n- ``.readStringAligned(): str`` - same as readString but aligned to 4 bytes after reading the string\n- ``.readStringAlignedArray(): [str]`` - reads an array of aligned strings\n- ``.align(align_by: int): int`` - aligns the cursor to the given input and returns the position after the alignment\n- ``.readVarInt(): int`` - reads a varint\n- ``.readLSB(): bytearray`` - reads the lsb data of the given size (in bytes to read -\u003e output length is 1/8 of that)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk0lb3%2Fbinaryreader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fk0lb3%2Fbinaryreader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fk0lb3%2Fbinaryreader/lists"}