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 🙏

© 2024 – Pkg Stats / Ryan Hefner

gpb

v0.8.2

Published

Pure node.js Google Protocol Buffers implementation

Downloads

10

Readme

Node-gpb

NPM version Build status


Google Protocol Buffers pure JavaScript implementation for node.js.

Protocol buffers are Google's language-neutral, platform-neutral, extensible mechanism for serializing structured data – think XML, but smaller, faster, and simpler. You define how you want your data to be structured once, then you can use special generated source code to easily write and read your structured data to and from a variety of data streams and using a variety of languages – Java, C++, or Python.

And now Google Protocol Buffers are available in node.js without compiling binary addons!

This module has been tested with node.js versions 0.8.26, 0.10.22 and 0.11.9.

Based on prtbfr.php by Gaetano Giunta.

Check out the Github repo for the source code.

Installation

You can install this module via npm:

$> npm install gpb

No specific libraries are needed because this is pure node.js module, not a binary addon.

Usage

var GPB = require('gpb');

var proto = {
  1: ["field_string", GPB.STRING, GPB.REQUIRED],
  2: ["field_double", GPB.DOUBLE, GPB.OPTIONAL],
  3: ["field_floats", GPB.FLOAT, GPB.REPEATED],
};

var data = {
  "field_string": "Some string",
  "field_double": 2e30,
  "field_floats": [
    1.1,
    2.2,
    3.3
  ]
};

var expected_encoded_data_length = GPB.encoded_length(data, proto);

var encoded_data = new Buffer(expected_encoded_data_length);

var actual_encoded_data_length = GPB.encode(encoded_data, 0/*offset*/, data, proto);

Contributing

To contribute any patches, simply fork this repository using GitHub and send a pull request to me. Thanks!

License

MIT license. See license text in file LICENSE.

Bitdeli Badge