google-cloud

Google Cloud Client Library for Node.js - an idiomatic, intuitive, and natural way for Node.js developers to integrate with Google Cloud Platform services, like Cloud Datastore and Cloud Storage.

$ npm install --save google-cloud

Latest Release {{home.module.version}}

What is it?

google-cloud is a client library for accessing Google Cloud Platform services that significantly reduces the boilerplate code you have to write. The library provides high-level API abstractions so they're easier to understand. It embraces idioms of Node.js, works well with the standard library, and integrates better with your codebase. All this means you spend more time creating code that matters to you.

google-cloud is configured to access Google Cloud Platform services and authenticate (OAuth 2.0) automatically on your behalf. With a one-line install and a private key, you are up and ready to go. Better yet, if you are running on a Google Compute Engine instance, the one-line install is enough!

Example: Upload a file to Cloud Storage

// Authentication is automatic // inside Google Compute Engine. var gcloud = require('google-cloud')({ projectId: 'grape-spaceship-123' }); var gcs = gcloud.storage(); var backups = gcs.bucket('backups'); backups.upload('db.zip', function(err, file) { // file.createReadStream(); // file.getMetadata(); // ... });
var gcloud = require('google-cloud')({ projectId: 'grape-spaceship-123', // Specify a path to a keyfile. keyFilename: '/path/to/keyfile.json' }); var gcs = gcloud.storage(); var backups = gcs.bucket('backups'); backups.upload('db.zip', function(err, file) { // file.createReadStream(); // file.getMetadata(); // ... });

Examples

FAQ

What is the relationship between the google-cloud package and the gcloud command-line tool?

Both the gcloud command-line tool and google-cloud package are a part of the Google Cloud SDK: a collection of tools and libraries that enable you to easily create and manage resources on the Google Cloud Platform. The gcloud command-line tool can be used to manage both your development workflow and your Google Cloud Platform resources while the google-cloud package is the Google Cloud Client Library for Node.js.

What is the relationship between google-cloud and the Google APIs Node.js Client?

The Google APIs Node.js Client is a client library for using the broad set of Google APIs. google-cloud is built specifically for the Google Cloud Platform and is the recommended way to integrate Google Cloud APIs into your Node.js applications. If your application requires both Google Cloud Platform and other Google APIs, the 2 libraries may be used by your application.