Socket
Socket
Sign inDemoInstall

proto-loader

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

proto-loader

Protocol Buffer loader module for webpack


Version published
Weekly downloads
705
increased by57.72%
Maintainers
1
Weekly downloads
 
Created
Source

Protocol Buffer loader module for webpack

Converts .proto files into JSON so they can be loaded without a parser. For use with webpack and ProtoBuf.js

Installation

npm install proto-loader

Usage

Documentation: Using loaders

/*
protobufjs has a light build that does not include code for parsing .proto
files. The extra code is not typically necessary if you're using this loader,
but if you still need it, you can change the below line to:
var ProtoBuf = require('protobufjs');
*/
var ProtoBuf = require('protobufjs/dist/protobuf-light');

var protoDefinition = require('proto!./message.proto');
// => returns object converted from message.proto, resolves imports

var builder = ProtoBuf.loadJson(protoDefinition);
//...

webpack config

module.exports = {
  module: {
    loaders: [
      {
        test: /\.proto$/,
        loader: "proto-loader"
      }
    ]
  }
};

Then you only need to write: require("./message.proto")

License

MIT (http://www.opensource.org/licenses/mit-license.php)

Keywords

FAQs

Package last updated on 15 Dec 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc