{"id":48985,"library":"protobuf-schema","title":"protobuf-schema","description":"Protobuf-schema v1.5.1 is a simple JavaScript parser for Protocol Buffers schema files (.proto). It converts .proto definitions into plain JavaScript objects and can also stringify objects back to .proto format. Unlike full protobuf libraries (e.g., protobuf.js), this package focuses solely on schema parsing without serialization or code generation. Development appears sparse (last release in 2016) and the package is likely in maintenance mode. Key differentiator: minimal, pure JS parser with no runtime dependencies.","status":"maintenance","version":"1.5.1","language":"javascript","source_language":"en","source_url":"https://github.com/mafintosh/protobuf-schema","tags":["javascript","protobuf","protocol","buffers","schema","parser","parse"],"install":[{"cmd":"npm install protobuf-schema","lang":"bash","label":"npm"},{"cmd":"yarn add protobuf-schema","lang":"bash","label":"yarn"},{"cmd":"pnpm add protobuf-schema","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package does not export a default; named export `parse`.","wrong":"const schema = require('protobuf-schema'); schema.parse(...)","symbol":"parse","correct":"import { parse } from 'protobuf-schema'"},{"note":"ESM import preferred; CJS still works.","wrong":"var stringify = require('protobuf-schema').stringify","symbol":"stringify","correct":"import { stringify } from 'protobuf-schema'"},{"note":"Namespace import works in ESM; CJS require still supported.","wrong":"const protoSchema = require('protobuf-schema')","symbol":"schema","correct":"import * as protoSchema from 'protobuf-schema'"}],"quickstart":{"code":"import { parse } from 'protobuf-schema';\nimport { readFileSync } from 'fs';\n\nconst schemaString = `\nmessage Point {\n  required int32 x = 1;\n  required int32 y = 2;\n  optional string label = 3;\n}\n`;\nconst schema = parse(schemaString);\nconsole.log(JSON.stringify(schema, null, 2));\n// Output: { package: null, enums: [], messages: [...] }","lang":"typescript","description":"Parses a hardcoded .proto schema string into a JavaScript object using the named `parse` export."},"warnings":[{"fix":"Use fs.readFileSync('file.proto') to read the file into a string or Buffer.","message":"The `parse` function accepts strings or Buffers, not direct file paths; use fs.readFileSync.","severity":"gotcha","affected_versions":"*"},{"fix":"Consider using protobuf.js or @bufbuild/protobuf for modern protobuf support.","message":"No activity since 2016; may not support newer protobuf syntax (proto3 features like maps, oneof, etc.).","severity":"deprecated","affected_versions":"*"},{"fix":"Use `import { parse, stringify } from 'protobuf-schema'`.","message":"Named exports are used; default import does not work.","severity":"gotcha","affected_versions":"*"},{"fix":"Install @types/protobuf-schema if available, or create own type stubs.","message":"Package uses `var` and no semicolons; not TypeScript-friendly, no types bundled.","severity":"gotcha","affected_versions":"*"}],"env_vars":null,"search_vec":"'2016':60 'also':29 'appear':55 'back':32 'buffer':15,82 'code':52 'convert':20 'definit':22 'depend':78 'develop':54 'differenti':70 'e.g':40 'file':17 'focus':44 'format':35 'full':37 'generat':53 'javascript':11,25,79 'js':73 'key':69 'last':57 'librari':39 'like':65 'mainten':67 'minim':71 'mode':68 'object':26,31 'packag':43,63 'pars':48,85 'parser':12,74,84 'plain':24 'proto':18,21,34 'protobuf':2,5,38,80 'protobuf-schema':1,4 'protobuf.js':41 'protocol':14,81 'pure':72 'releas':58 'runtim':77 'schema':3,6,16,47,83 'serial':50 'simpl':10 'sole':45 'spars':56 'stringifi':30 'unlik':36 'v1.5.1':7 'without':49","created_at":"2026-06-07T16:59:28.021855+00:00","updated_at":"2026-06-07T16:59:28.021855+00:00","problems":[{"fix":"Use `import { parse } from 'protobuf-schema'` or `const { parse } = require('protobuf-schema')`.","cause":"Importing default export instead of named export.","error":"TypeError: schema.parse is not a function"},{"fix":"Remove the syntax line or use proto2 style without quotes.","cause":"Input uses proto3 syntax keyword 'syntax = \"proto3\";' which is not supported.","error":"Syntax error: unrecognized syntax identifier"},{"fix":"In Node, use `import fs from 'fs'`. In browser, pass the schema string directly.","cause":"Trying to use fs in browser or without importing the module.","error":"ReferenceError: fs is not defined"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/mafintosh/protobuf-schema","github":"https://github.com/mafintosh/protobuf-schema","docs":null,"changelog":null,"pypi":null,"npm":"protobuf-schema","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}