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

node-google-prediction

v0.0.4

Published

Node client for Google Prediction API

Downloads

24

Readme

node-google-prediction

A node.js client for the Google Prediction API - To be used for Server to Server applications. MIT license

v0.0.1~beta

A more extensive implementation to follow.

Integrates with Google Prediction API v1.5

Introduction

This is a node client library that abstracts the lower level integration implementation with the google prediction API and allows you to get up and running quickly and start using the api to your business benefit.

This client makes it easy to authenticate using OAuth2 by using the private key given to you by Google when you created your service account.

Google at present do not provide their own Node.js client which was the motivation for creating this client.

So if you want to create a web service application, this is a perfect library to get you started as this will allow you to utilise your service account details to authenticate and use the prediction API.

Prerequisites

I assume you have read and have a good understanding of all that is covered in Google Prediction API developer guide. This will help in understanding and using this library successfully.

Installation

npm module to be published shortly.

Usage

    var Client = require('node-google-prediction-api');
    var client = new Client({claimSetISS        : //The Service Account email. Check your Gogole Console -> API Access,
                             path               : //Absolute path to the service account private key (in .pem format)
                             modelInsertFields  : //Defaults are provided in config/config.js but you may want to provide different ones});

    ...

    client.accessTokenRequest(function(err, data, response) {
      if(err) {
        throw new Error(err);
      }
      console.log(data);
      var token = data.access_token;
      // Cache your token as it is valid for 1 hour and you can reuse. Only make a fresh token request if HTTP401 is received.
      // **Note** is down to you to cache and reuse an access token correctly so ensure you handle HTTP401 in other calls to Client.
    });

    //**Hint:** Look at test/system/testClient for further usage details.

Running tests

Due to the nature of the Google Prediction API, in order to run tests you will need to provide some details withing config/config.js. This is so you can provide your own Service Account details and test your own trained models.