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 🙏

© 2025 – Pkg Stats / Ryan Hefner

protobuf-javascript-with-from-object

v3.21.2-2

Published

protocolbuffers/protobuf-javascript with fromObject method

Readme

kzolti/protobuf-javascript-with-from-object

Google Protocol Buffers for JavaScript with fromObject method

kzolti/protobuf-javascript submodule

This project uses a fork of protocolbuffers/protobuf-javascript as a submodule. The fork, located at kzolti/protobuf-javascript, includes the following differences compared to the upstream repository:

Changes Made

Added a fromObject method to the generated JavaScript protobuf classes.

Manual check differencies

https://github.com/protocolbuffers/protobuf-javascript/compare/main...kzolti:protobuf-javascript:main?diff=split&w=

git clone https://github.com/kzolti/protobuf-javascript.git                           && \ 
cd protobuf-javascript                                                                && \ 
git checkout main                                                                     && \
git remote add upstream https://github.com/protocolbuffers/protobuf-javascript.git    && \
git fetch upstream                                                                    && \
git diff upstream/main main   

Changes to made in js_generator.cc (2024-06-12)

diff --git a/generator/js_generator.cc b/generator/js_generator.cc
index 44d00b1..7b97962 100644
--- a/generator/js_generator.cc
+++ b/generator/js_generator.cc
@@ -1980,7 +1980,7 @@ void Generator::GenerateClass(const GeneratorOptions& options,
   if (!NamespaceOnly(desc)) {
     printer->Print("\n");
     GenerateClassFieldInfo(options, printer, desc);
-
+    GenerateClassFromObject(options, printer, desc);
     GenerateClassToObject(options, printer, desc);
     // These must come *before* the extension-field info generation in
     // GenerateClassRegistration so that references to the binary

Installation and usage

Note: This package only includes the Linux_x86_64 binary. For other platforms, follow the instructions at Building from Source.

npm install kzolti/protobuf-javascript-with-from-object --save

  If other modules reference the google-protobuf package, add the following to package.json:

 "overrides": {
    "google-protobuf": "protobuf-javascript-with-from-object"
  }

  or yarn resolutions.

Generate protobuf pb.js file

protoc --js_out=library=myproto_libs,binary:. messages.proto

Generate typescript definition files

  Install protoc-gen-ts-with-from-object

npm install protoc-gen-ts-with-from-object --save
protoc --js_out=library=myproto_libs,binary:.  --ts_out=.  messages.proto

Using latest protoc binary from your project:

  install latest-protoc-binary

npm i latest-protoc-binary
npx protoc --version

If necessary, install and set up module-alias:

npm install module-alias --save

  In index.js:

const moduleAlias = require('module-alias');
moduleAlias.addAlias('google-protobuf', 'protobuf-javascript-with-from-object');

Building from source

Note: Bazel runtime environment is required to build the project.

git clone https://github.com/kzolti/protobuf-javascript-with-from-object.git
cd protobuf-javascript-with-from-object                                     
npm install
npm run build
npm pack