grpc-lite

2016.12.3 • Public • Published

grpc-lite

this zero-dependency package will download and install the grpc-v1.0.1 prebuilt-binary from https://storage.googleapis.com/grpc-precompiled-binaries/node/grpc

travis-ci.org build-status grpc coverage

NPM

package-listing

documentation

api-doc

api-doc

todo

  • upgrade to grpc v1.1.x when stable
  • none

change since 6f1f48ac

  • npm publish 2016.12.3
  • update documentation
  • none

this package requires

  • darwin or linux os
  • node (version v4.x to v6.x)

additional info

build-status travis-ci.org build-status

build commit status

git-branch : master beta alpha
test-report : test-report test-report test-report
coverage : istanbul coverage istanbul coverage istanbul coverage
build-artifacts : build-artifacts build-artifacts build-artifacts

master branch

  • stable branch
  • HEAD should be tagged, npm-published package

beta branch

  • semi-stable branch
  • HEAD should be latest, npm-published package

alpha branch

  • unstable branch
  • HEAD is arbitrary
  • commit history may be rewritten

package.json

{
    "package.json": true,
    "author": "kai zhu <kaizhu256@gmail.com>",
    "description": "{{packageJson.description}}",
    "devDependencies": {
        "electron-lite": "kaizhu256/node-electron-lite#alpha",
        "utility2": "kaizhu256/node-utility2#alpha"
    },
    "engines": { "node": ">=4 <7" },
    "keywords": [
        "api",
        "grpc",
        "light", "lightweight", "lite",
        "protobuf"
    ],
    "license": "MIT",
    "main": "lib.grpc",
    "name": "grpc-lite",
    "os": ["darwin", "linux"],
    "repository": {
        "type": "git",
        "url": "https://github.com/kaizhu256/node-grpc-lite.git"
    },
    "scripts": {
        "build-ci": "utility2 shRun shReadmeBuild",
        "postinstall": "./lib.grpc.sh shNpmPostinstall",
        "test": "\
rm -fr external /tmp/grpc_node-* && \
npm run postinstall && \
export PORT=$(utility2 shServerPortRandom) && utility2 test test.js"
    },
    "version": "2016.12.3"
}

changelog of last 50 commits

screen-capture

internal build-script

  • build.sh
# build.sh 
 
# this shell script will run the build for this package 
 
shBuildCiTestPre() {(set -e
# this function will run the pre-test build 
    # test published-package 
    (export MODE_BUILD=npmTestPublished &&
        shRunScreenCapture shNpmTestPublished) || return $?
    return
)}
 
shBuild() {(set -e
# this function will run the main build 
    # init env 
    . node_modules/.bin/utility2 && shInit
    # cleanup github-gh-pages dir 
    # export BUILD_GITHUB_UPLOAD_PRE_SH="rm -fr build" 
    # init github-gh-pages commit-limit 
    export COMMIT_LIMIT=16
    # if branch is alpha, beta, or master, then run default build 
    if [ "$CI_BRANCH" = alpha ] ||
        [ "$CI_BRANCH" = beta ] ||
        [ "$CI_BRANCH" = master ]
    then
        shBuildCiDefault
        # upload build-artifacts to github, and if number of commits > $COMMIT_LIMIT, 
        # then squash older commits 
        (export MODE_BUILD=buildGithubUpload &&
            shBuildGithubUpload) || return $?
    fi
)}
shBuild

original README.md

npm

Node.js gRPC Library

PREREQUISITES

  • node: This requires node to be installed, version 0.12 or above. If you instead have the nodejs executable on Debian, you should install the nodejs-legacy package.

  • Note: If you installed node via a package manager and the version is still less than 0.12, try directly installing it from nodejs.org.

INSTALLATION

Install the gRPC NPM package

npm install grpc

BUILD FROM SOURCE

  1. Clone the grpc Git Repository.
  2. Run npm install from the repository root.
  • Note: On Windows, this might fail due to nodejs issue #4932 in which case, you will see something like the following in npm install's output (towards the very beginning):

     ..
     Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
     WINDOWS_BUILD_WARNING
      "..\IMPORTANT: Due to https:\github.com\nodejs\node\issues\4932, to build this library on Windows, you must first remove C:\Users\jenkins\.node-gyp\4.4.0\include\node\openssl"
      ...
      ..
    

    To fix this, you will have to delete the folder C:\Users\<username>\.node-gyp\<node_version>\include\node\openssl and retry npm install

TESTING

To run the test suite, simply run npm test in the install location.

API

This library internally uses ProtoBuf.js, and some structures it exports match those exported by that library

If you require this module, you will get an object with the following members

function load(filename)

Takes a filename of a Protocol Buffer file, and returns an object representing the structure of the protocol buffer in the following way:

  • Namespaces become maps from the names of their direct members to those member objects
  • Service definitions become client constructors for clients for that service. They also have a service member that can be used for constructing servers.
  • Message definitions become Message constructors like those that ProtoBuf.js would create
  • Enum definitions become Enum objects like those that ProtoBuf.js would create
  • Anything else becomes the relevant reflection object that ProtoBuf.js would create
function loadObject(reflectionObject)

Returns the same structure that load returns, but takes a reflection object from ProtoBuf.js instead of a file name.

function Server([serverOpions])

Constructs a server to which service/implementation pairs can be added.

status

An object mapping status names to status code numbers.

callError

An object mapping call error names to codes. This is primarily useful for tracking down certain kinds of internal errors.

Credentials

An object with factory methods for creating credential objects for clients.

ServerCredentials

An object with factory methods for creating credential objects for servers.

Package Sidebar

Install

npm i grpc-lite

Weekly Downloads

6

Version

2016.12.3

License

MIT

Last publish

Collaborators

  • kaizhu