npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@pauldeng/node-red-contrib-protobuf

v2.0.2

Published

Node-RED nodes for encoding and decoding Protocol Buffers.

Readme

@pauldeng/node-red-contrib-protobuf

npm CI Node License

Encode and decode Protocol Buffers in Node-RED flows.

This package adds three Node-RED nodes built on protobuf.js:

  • protobuf-file - a configuration node that loads one or more .proto schemas, either from disk or from an inline definition edited in the dialog.
  • encode - converts a JavaScript object on msg.payload into a protobuf-encoded Buffer.
  • decode - converts a protobuf-encoded Buffer on msg.payload into a JavaScript object.

proto2, proto3, and Protobuf Editions 2023 / 2024 are supported.

Compatibility

  • Node-RED >= 4.1.0 (tested against 5.x)
  • Node.js >= 20.19.0

Install

From the Node-RED editor: Menu > Manage palette > Install, then search for @pauldeng/node-red-contrib-protobuf (or just protobuf).

From a shell, in your Node-RED user directory:

cd ~/.node-red
npm install @pauldeng/node-red-contrib-protobuf

Quick start

  1. Drop an encode or decode node onto a flow.
  2. Open its dialog and create a protobuf-file config node pointing at one or more .proto files (or paste an inline schema).
  3. Set the Type field (for example package.Message) - or supply msg.protobufType on each message, which overrides the configured Type.
  4. Send msg.payload as a JavaScript object (encode) or a Buffer (decode).

Use the Validate button in the protobuf-file dialog to confirm the schema loaded and to copy the exact type name into the Type field.

Examples

Importable example flows are bundled with the package. Open Menu > Import > Examples > @pauldeng/node-red-contrib-protobuf in the Node-RED editor:

| # | Example | Shows | | --- | --- | --- | | 1 | encode basics | turning a JavaScript object into protobuf wire bytes | | 2 | decode basics | turning protobuf wire bytes back into a JavaScript object | | 3 | proto2 round trip | required, optional, and default values | | 4 | proto3 round trip | implicit presence and snake_case to camelCase conversion | | 5 | edition 2023 round trip | Protobuf Editions schema | | 6 | edition 2024 round trip | Protobuf Editions schema | | 7 | delimited stream | several length-prefixed messages in one buffer | | 8 | chained protos | a root schema that imports types from other files |

Each flow's comment node explains what it shows. The schemas live in examples/protos/.

Features

  • Encode - strict verification or protobuf.js fromObject conversion; base64 and base64url byte input; warn-and-drop or raise-error on invalid payloads.
  • Decode - configurable enum / long / bytes representation; include unset defaults, empty arrays / objects, virtual oneofs; JSON-safe NaN / Infinity values.
  • Delimited streams - length-prefixed encodeDelimited / decodeDelimited framing for serial or TCP-style flows.
  • Inline definitions - type or paste a schema directly into the config dialog with protobuf syntax highlighting, saveable to the Node-RED library as a .proto file.
  • Multi-file schemas - comma-separated paths, automatic import resolution, debounced file-watch reload.

Important: proto3 "false" vs "not set"

[!WARNING] Plain proto3 scalar fields use implicit presence. A value equal to the field default (false, 0, "") is never transmitted, and the wire bytes for "set to false" and "never set" are identical. After decoding, the field is simply missing:

schema:  bool enabled = 1;
flow:    { "enabled": false } -> encode -> decode -> { }      enabled is gone!

This is standard protobuf behavior (field presence guide), not a bug in this node. When your flows must distinguish false or 0 from "not set", declare the field optional in proto3 - or use a proto2 or Editions schema, which track presence by default:

schema:  optional bool enabled = 1;
flow:    { "enabled": false } -> encode -> decode -> { "enabled": false }

Documentation

Full per-node options and help are in the editor's info sidebar - open any node and switch to the help tab.

Release history and migration notes are in CHANGELOG.md.

For contributors and AI coding agents, deeper docs live in AGENTS.md and docs/:

Contributing

See docs/change-workflow.md. Quick start:

npm install
npm test
npm run lint
npm run coverage
npm run test:ui      # Playwright editor tests
npm run test:docker  # packaged integration tests (requires Docker)

Maintenance / fork

This is a maintained fork of the original node-red-contrib-protobuf by Alexander Wellbrock (last published 2023-01-06). The fork is published under the @pauldeng/ npm scope; the Node-RED node types (encode, decode, protobuf-file) are unchanged so existing flows continue to load.

Differences from the unscoped 1.1.x line:

  • protobufjs upgraded from 6.x to 8.x.
  • Node.js floor raised to >=20.19.0; Node-RED floor raised to >=4.1.0.
  • proto2, Editions 2023, and Editions 2024 round-trip coverage.
  • Delimited streams, inline .proto definitions, validate-and-list-types endpoint.
  • Renovated editor dialogs and palette appearance.

To switch from the unscoped package:

cd ~/.node-red
npm uninstall node-red-contrib-protobuf
npm install @pauldeng/node-red-contrib-protobuf

If your saved flows hard-coded node_modules/node-red-contrib-protobuf/examples/protos/... as a protopath, rewrite the path to node_modules/@pauldeng/node-red-contrib-protobuf/examples/protos/..., switch to an absolute path on disk, or re-import the example flow from Import → Examples to pick up the new path.

License

BSD 3-Clause. Original author: Alexander Wellbrock.