protocol-buffers-schema is a minimalist JavaScript library designed for parsing Protocol Buffers (.proto) schema files into a structured JavaScript object and stringifying such objects back into the .proto format. It explicitly focuses on schema definition parsing rather than binary serialization or deserialization of actual Protobuf messages. The current stable version is 3.6.1, though the last npm publication (for 3.6.0) was approximately four years ago, suggesting a maintenance mode with an infrequent release cadence, if any. Its primary differentiator is its straightforward API for schema manipulation, contrasting with more comprehensive Protobuf libraries that include code generation, runtime encoding/decoding, and gRPC support. This package serves as a foundational component for tools that need to inspect or modify Protobuf definitions programmatically.
npm install protocol-buffers-schemaVerified import paths — ran on the pinned version, not inferred.
Demonstrates parsing a Protobuf schema string into a JavaScript object and then stringifying it back, also showing how to access parsed schema elements.
Use a dedicated Protobuf runtime library (e.g., `npm install protobufjs`) for encoding and decoding binary data.
Review the parsed output carefully for newer syntax. If issues arise, consider alternative, more actively maintained Protobuf parsing solutions or pre-process your .proto files to simpler forms if possible.
Always use the latest stable version (3.6.1) to benefit from bug fixes and improved parsing logic. Consult the GitHub repository's commit history for specific changes between major versions if migrating from a very old version.
This library only parses and stringifies Protobuf schema definitions. To encode or decode binary Protobuf messages, use a different library such as `protobuf.js` or `google-protobuf`.
For CommonJS, use `const schema = require('protocol-buffers-schema'); schema.parse(...)`. For ESM, use `import schema from 'protocol-buffers-schema'; schema.parse(...)`.Ensure `syntax = "proto2";` is present in your `.proto` file if you intend to use explicit `required`/`optional` field rules. If using `proto3` without Editions, these keywords are not valid for field rules.
No dependency data recorded yet.