{"id":16188329,"url":"https://github.com/konsumer/rawprotoparse","last_synced_at":"2025-03-19T03:30:40.606Z","repository":{"id":212625198,"uuid":"731419153","full_name":"konsumer/rawprotoparse","owner":"konsumer","description":"Very small raw protobuf parser (js)","archived":false,"fork":false,"pushed_at":"2024-05-03T05:43:58.000Z","size":748,"stargazers_count":6,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-28T14:47:36.810Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://konsumer.js.org/rawprotoparse/","language":"JavaScript","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/konsumer.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":"2023-12-14T03:26:03.000Z","updated_at":"2025-01-15T16:07:28.000Z","dependencies_parsed_at":"2024-05-03T06:48:24.963Z","dependency_job_id":"beaafb89-a0d1-4709-ae91-2a07b77b8d60","html_url":"https://github.com/konsumer/rawprotoparse","commit_stats":null,"previous_names":["konsumer/rawprotoparse"],"tags_count":10,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Frawprotoparse","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Frawprotoparse/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Frawprotoparse/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/konsumer%2Frawprotoparse/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/konsumer","download_url":"https://codeload.github.com/konsumer/rawprotoparse/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243965752,"owners_count":20375917,"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-10-10T07:26:00.058Z","updated_at":"2025-03-19T03:30:40.298Z","avatar_url":"https://github.com/konsumer.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003e [!CAUTION]\n\u003e This has been depracated, in favor of [rawproto](https://github.com/konsumer/rawproto), where I did similar  stuff, but improved things a bit. You should use that, instead.\n\nVery small raw protobuf parser.\n\nThis is similar to [rawproto](https://github.com/konsumer/rawproto), but without anything around the schema-def.\n\nUse this if you want a really light library, and don't need to generate the schema for some raw protobuf messages, or anything like that. It's fast \u0026 light. It has 0-dependencies, and can be used in just about any place that runs javascript (browser, nodejs, cloudflare-edge, deno, bun, etc.)\n\nIt can read a `Buffer` (nodejs) or `Uint8Array` of bytes, and outputs a JSON-encodable object.\n\n## usage\n\n### nodejs (module)\n\n```js\nimport rawprotoparse from 'rawprotoparse'\nimport { readFile } from 'fs/promises'\n\nconsole.log(rawprotoparse(await readFile('somebinaryfile.pb')))\n```\n\n### nodejs (commonjs)\n\n```js\nconst { rawprotoparse }  = require('rawprotoparse')\nconst { readFile }  = require('fs')\n\nreadFile('somebinaryfile.pb', (err, bytes) =\u003e {\n  console.log(rawprotoparse(bytes))\n})\n```\n\n### web (module)\n\n```html\n\u003cscript type=\"module\"\u003e\nimport rawprotoparse from \"https://esm.run/rawprotoparse\"\n\nconsole.log(rawprotoparse(someBytes))\n\u003c/script\u003e\n```\n\n### options\n\n```js\nrawprotoparse (buffer, { prefix = 'f', stringMode = 'auto', arrayMode = false })\n```\n\n- `prefix` - a string to put in front of the fieldnames\n- `stringMode` - a string for what to do with buffers.\n  - `auto` - try to guess if it's `string` or `buffer`, based on bytes\n  - `string` - force a string, that may have escaped characters\n  - `buffer` - outputs an array of bytes. I use a plain array so that you can encode to JSON easier\n- `arrayMode` - a boolean that forces all fields to be arrays. This allows you to assume all values are arrays (not just repeated fields)\n- `valueHandler` - a custom value-handler, if you want to do something special. See [test](https://github.com/konsumer/rawprotoparse/blob/main/test/rawproto.test.js#L78-L93) for example.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonsumer%2Frawprotoparse","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkonsumer%2Frawprotoparse","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkonsumer%2Frawprotoparse/lists"}