Skip to content

Latest commit

 

History

History
62 lines (46 loc) · 1.81 KB

README.md

File metadata and controls

62 lines (46 loc) · 1.81 KB

protoc-binary

Downloads Google Protocol Buffers binary wrapped as npm package.
By default, it will download the latest released version.
If an older version is required, add "protoc-binary": "x.x.x" at the root of your package.json.

Install

npm i -D protoc-binary

To force re-check for latest protoc binary releases, simply run npm ci.
Alternatively, you can manually invoke the install script node -e "require('protoc-binary/install')".
If working in both Windows and WSL, you can invoke the install script to download binaries for both, however when switching OS you should run npm ci.

Usage

Node.js require("protoc-binary").protoc(["--version"])
npx npx protoc --version
Linux/Powershell node_modules/.bin/protoc --version
Windows cmd node_modules\\.bin\\protoc --version

API

protoc

/* Function wrapper for protoc binary */
require("protoc-binary").protoc(
    args,    /* {string[]} protoc arguments */
    protoDir /* {string} [optional] absolute path to dir containing .proto files */
);

binary

/* Returns the absolute path to local protoc binary */
require("protoc-binary").binary;

version

/* Returns version of local protoc binary */
require("protoc-binary").version;

Supported versions

See official protoc binaries download page.

  • osx-aarch_64.zip
  • osx-x86_64.zip
  • linux-x86_32.zip
  • linux-x86_64.zip
  • linux-arm64.zip
  • win32.zip
  • win64.zip