Socket
Socket
Sign inDemoInstall

google-cloud

Package Overview
Dependencies
308
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.49.0 to 0.50.0

36

package.json
{
"name": "google-cloud",
"version": "0.49.0",
"version": "0.50.0",
"author": "Google Inc.",

@@ -103,18 +103,18 @@ "description": "Cloud APIs Client Library for Node.js",

"dependencies": {
"@google-cloud/bigquery": "^0.8.0",
"@google-cloud/bigtable": "^0.8.0",
"@google-cloud/compute": "^0.5.0",
"@google-cloud/datastore": "^0.7.0",
"@google-cloud/dns": "^0.5.0",
"@google-cloud/language": "^0.9.0",
"@google-cloud/logging": "^0.8.0",
"@google-cloud/monitoring": "^0.1.4",
"@google-cloud/prediction": "^0.5.0",
"@google-cloud/pubsub": "^0.8.3",
"@google-cloud/resource": "^0.6.0",
"@google-cloud/spanner": "^0.1.0",
"@google-cloud/speech": "^0.7.0",
"@google-cloud/storage": "^0.8.0",
"@google-cloud/translate": "^0.7.0",
"@google-cloud/vision": "^0.10.0",
"@google-cloud/bigquery": "^0.9.0",
"@google-cloud/bigtable": "^0.9.0",
"@google-cloud/compute": "^0.6.0",
"@google-cloud/datastore": "^0.8.0",
"@google-cloud/dns": "^0.6.0",
"@google-cloud/language": "^0.10.0",
"@google-cloud/logging": "^0.9.0",
"@google-cloud/monitoring": "^0.2.0",
"@google-cloud/prediction": "^0.6.0",
"@google-cloud/pubsub": "^0.9.0",
"@google-cloud/resource": "^0.7.0",
"@google-cloud/spanner": "^0.3.0",
"@google-cloud/speech": "^0.8.0",
"@google-cloud/storage": "^1.0.0",
"@google-cloud/translate": "^0.8.0",
"@google-cloud/vision": "^0.11.0",
"extend": "^3.0.0"

@@ -132,4 +132,4 @@ },

"engines": {
"node": ">=0.4.0"
"node": ">=4.0.0"
}
}

@@ -13,9 +13,14 @@ # Cloud Node.js Client

This client supports the following Google Cloud Platform services at a [General Availability (GA)](#versioning) quality level:
* [Cloud Storage](#cloud-storage-ga) (GA)
This client supports the following Google Cloud Platform services at a [Beta](#versioning) quality level:
* [Cloud Datastore](#cloud-datastore-beta) (Beta)
* [Cloud Natural Language](#cloud-natural-language-beta) (Beta)
* [Cloud Translation API](#cloud-translation-api-beta) (Beta)
* [Cloud Vision](#cloud-vision-beta) (Beta)
* [Google BigQuery](#google-bigquery-beta) (Beta)
* [Cloud Datastore](#cloud-datastore-beta) (Beta)
* [Cloud Storage](#cloud-storage-beta) (Beta)
* [Google Stackdriver Logging](#google-stackdriver-logging-beta) (Beta)
* [Cloud Vision](#cloud-vision-beta) (Beta)

@@ -26,3 +31,2 @@ This client supports the following Google Cloud Platform services at an [Alpha](#versioning) quality level:

* [Cloud DNS](#cloud-dns-alpha) (Alpha)
* [Cloud Natural Language](#cloud-natural-language-alpha) (Alpha)
* [Cloud Pub/Sub](#cloud-pubsub-alpha) (Alpha)

@@ -32,3 +36,2 @@ * [Cloud Resource Manager](#cloud-resource-manager-alpha) (Alpha)

* [Cloud Speech](#cloud-speech-alpha) (Alpha)
* [Cloud Translation API](#cloud-translation-api-alpha) (Alpha)
* [Google Compute Engine](#google-compute-engine-alpha) (Alpha)

@@ -43,7 +46,38 @@ * [Google Prediction API](#google-prediction-api-alpha) (Alpha)

We recommend installing the individual packages that you need, which are provided under the `@google-cloud` namespace. For example:
```sh
$ npm install --save @google-cloud/datastore
$ npm install --save @google-cloud/storage
```
```js
var config = {
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
};
var datastore = require('@google-cloud/datastore')(config);
var storage = require('@google-cloud/storage')(config);
```
#### The google-cloud meta-package
We also provide a meta-package, `google-cloud`, which provides all of the individual APIs. However, in order to keep file size and memory use low, the use of this package is not recommended.
If you want the kitchen sink, however, get it with:
```sh
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud')({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
var datastore = gcloud.datastore();
var storage = gcloud.storage();
```
## Example Applications

@@ -66,3 +100,3 @@

If you are running this client on Google Compute Engine, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.
If you are running this client on Google Cloud Platform, we handle authentication for you with no configuration. You just need to make sure that when you [set up the GCE instance][gce-how-to], you add the correct scopes for the APIs you want to access.

@@ -127,35 +161,26 @@ ``` js

## Google BigQuery (Beta)
## Cloud Storage (GA)
- [API Documentation][gcloud-bigquery-docs]
- [Official Documentation][cloud-bigquery-docs]
- [API Documentation][gcloud-storage-docs]
- [Official Documentation][cloud-storage-docs]
#### Using the all-in-one module
#### Using the Cloud Storage API module
```
$ npm install --save google-cloud
$ npm install --save @google-cloud/storage
```
```js
var gcloud = require('google-cloud');
var bigquery = gcloud.bigquery;
var storage = require('@google-cloud/storage');
```
#### Using the BigQuery API module
#### Preview
```
$ npm install --save @google-cloud/bigquery
```
```js
var bigquery = require('@google-cloud/bigquery');
```
var fs = require('fs');
#### Preview
```js
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).
var bigqueryClient = bigquery({
var gcs = storage({
projectId: 'grape-spaceship-123',

@@ -165,17 +190,32 @@ keyFilename: '/path/to/keyfile.json'

// Access an existing dataset and table.
var schoolsDataset = bigqueryClient.dataset('schools');
var schoolsTable = schoolsDataset.table('schoolsData');
// Create a new bucket.
gcs.createBucket('my-new-bucket', function(err, bucket) {
if (!err) {
// "my-new-bucket" was successfully created.
}
});
// Import data into a table.
schoolsTable.import('/local/file.json', function(err, job) {});
// Reference an existing bucket.
var bucket = gcs.bucket('my-existing-bucket');
// Get results from a query job.
var job = bigqueryClient.job('job-id');
// Upload a local file to a new file to be created in your bucket.
bucket.upload('/photos/zoo/zebra.jpg', function(err, file) {
if (!err) {
// "zebra.jpg" is now in your bucket.
}
});
// Use a callback.
job.getQueryResults(function(err, rows) {});
// Download a file from your bucket.
bucket.file('giraffe.jpg').download({
destination: '/photos/zoo/giraffe.jpg'
}, function(err) {});
// Or get the same results as a readable stream.
job.getQueryResults().on('data', function(row) {});
// Streams are also supported for reading and writing files.
var remoteReadStream = bucket.file('giraffe.jpg').createReadStream();
var localWriteStream = fs.createWriteStream('/photos/zoo/giraffe.jpg');
remoteReadStream.pipe(localWriteStream);
var localReadStream = fs.createReadStream('/photos/zoo/zebra.jpg');
var remoteWriteStream = bucket.file('zebra.jpg').createWriteStream();
localReadStream.pipe(remoteWriteStream);
```

@@ -191,13 +231,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var datastore = gcloud.datastore;
```
#### Using the Cloud Datastore API module

@@ -259,37 +288,24 @@

## Cloud Storage (Beta)
## Cloud Natural Language (Beta)
- [API Documentation][gcloud-storage-docs]
- [Official Documentation][cloud-storage-docs]
- [API Documentation][gcloud-language-docs]
- [Official Documentation][cloud-language-docs]
#### Using the all-in-one module
#### Using the Natural Language API module
```
$ npm install --save google-cloud
$ npm install --save @google-cloud/language
```
```js
var gcloud = require('google-cloud');
var storage = gcloud.storage;
var language = require('@google-cloud/language');
```
#### Using the Cloud Storage API module
```
$ npm install --save @google-cloud/storage
```
```js
var storage = require('@google-cloud/storage');
```
#### Preview
```js
var fs = require('fs');
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).
// global basis (see Authorization section above).
var gcs = storage({
var languageClient = language({
projectId: 'grape-spaceship-123',

@@ -299,68 +315,129 @@ keyFilename: '/path/to/keyfile.json'

// Create a new bucket.
gcs.createBucket('my-new-bucket', function(err, bucket) {
if (!err) {
// "my-new-bucket" was successfully created.
}
// Get the entities from a sentence.
languageClient.detectEntities('Stephen of Michigan!', function(err, entities) {
// entities = [
// {
// name: 'Stephen',
// type: 'PERSON',
// metadata: {
// mid: '/m/05d8y4q'
// },
// salience: 0.7309288382530212,
// mentions: [
// {
// text: {
// content: 'Stephen',
// beginOffset: -1
// },
// type: 'PROPER'
// }
// ]
// },
// // ...
// ]
});
// Reference an existing bucket.
var bucket = gcs.bucket('my-existing-bucket');
// Create a document if you plan to run multiple detections.
var document = languageClient.document('Contributions welcome!');
// Upload a local file to a new file to be created in your bucket.
bucket.upload('/photos/zoo/zebra.jpg', function(err, file) {
if (!err) {
// "zebra.jpg" is now in your bucket.
}
// Analyze the sentiment of the document.
document.detectSentiment(function(err, sentiment) {
// sentiment = {
// magnitude: 0.5,
// score: 0.5
// }
});
// Download a file from your bucket.
bucket.file('giraffe.jpg').download({
destination: '/photos/zoo/giraffe.jpg'
}, function(err) {});
// Streams are also supported for reading and writing files.
var remoteReadStream = bucket.file('giraffe.jpg').createReadStream();
var localWriteStream = fs.createWriteStream('/photos/zoo/giraffe.jpg');
remoteReadStream.pipe(localWriteStream);
var localReadStream = fs.createReadStream('/photos/zoo/zebra.jpg');
var remoteWriteStream = bucket.file('zebra.jpg').createWriteStream();
localReadStream.pipe(remoteWriteStream);
// Parse the syntax of the document.
document.annotate(function(err, annotation) {
// annotation = {
// language: 'en',
// sentiment: {
// magnitude: 0.30000001192092896,
// score: 0.30000001192092896
// },
// entities: [
// {
// name: 'Contributions',
// type: 'OTHER',
// metadata: {},
// salience: 1,
// mentions: [
// {
// text: {
// content: 'Contributions',
// beginOffset: -1
// },
// type: 'COMMON'
// }
// ]
// }
// ],
// sentences: [
// {
// text: {
// content: 'Contributions welcome!',
// beginOffset: -1
// },
// sentiment: {
// magnitude: 0.30000001192092896,
// score: 0.30000001192092896
// }
// }
// ],
// tokens: [
// {
// text: {
// content: 'Contributions',
// beginOffset: -1
// },
// partOfSpeech: {
// tag: 'NOUN',
// aspect: 'ASPECT_UNKNOWN',
// case: 'CASE_UNKNOWN',
// form: 'FORM_UNKNOWN',
// gender: 'GENDER_UNKNOWN',
// mood: 'MOOD_UNKNOWN',
// number: 'PLURAL',
// person: 'PERSON_UNKNOWN',
// proper: 'PROPER_UNKNOWN',
// reciprocity: 'RECIPROCITY_UNKNOWN',
// tense: 'TENSE_UNKNOWN',
// voice: 'VOICE_UNKNOWN'
// },
// dependencyEdge: {
// headTokenIndex: 1,
// label: 'NSUBJ'
// },
// lemma: 'contribution'
// },
// // ...
// ]
// }
});
```
## Google Stackdriver Logging (Beta)
## Cloud Translation API (Beta)
- [API Documentation][gcloud-logging-docs]
- [Official Documentation][cloud-logging-docs]
- [API Documentation][gcloud-translate-docs]
- [Official Documentation][cloud-translate-docs]
#### Using the all-in-one module
#### Using the Google Translate API module
```
$ npm install --save google-cloud
$ npm install --save @google-cloud/translate
```
```js
var gcloud = require('google-cloud');
var logging = gcloud.logging;
var translate = require('@google-cloud/translate');
```
#### Using the Google Stackdriver Logging API module
```
$ npm install --save @google-cloud/logging
```
```js
var logging = require('@google-cloud/logging');
```
#### Preview
```js
// Authenticating on a global-basis. You can also authenticate on a per-API-
// basis (see Authentication section above).
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).
var loggingClient = logging({
var translateClient = translate({
projectId: 'grape-spaceship-123',

@@ -370,32 +447,29 @@ keyFilename: '/path/to/keyfile.json'

// Create a sink using a Bucket as a destination.
var gcs = storage();
// Translate a string of text.
translateClient.translate('Hello', 'es', function(err, translation) {
if (!err) {
// translation = 'Hola'
}
});
loggingClient.createSink('my-new-sink', {
destination: gcs.bucket('my-sink')
}, function(err, sink) {});
// Write a critical entry to a log.
var syslog = loggingClient.log('syslog');
var metadata = {
resource: {
type: 'gce_instance',
labels: {
zone: 'global',
instance_id: '3'
}
// Detect a language from a string of text.
translateClient.detect('Hello', function(err, results) {
if (!err) {
// results = {
// language: 'en',
// confidence: 1,
// input: 'Hello'
// }
}
};
var entry = syslog.entry(metadata, {
delegate: process.env.user
});
syslog.critical(entry, function(err) {});
// Get all entries in your project.
loggingClient.getEntries(function(err, entries) {
// Get a list of supported languages.
translateClient.getLanguages(function(err, languages) {
if (!err) {
// `entries` contains all of the entries from the logs in your project.
// languages = [
// 'af',
// 'ar',
// 'az',
// ...
// ]
}

@@ -411,13 +485,2 @@ });

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var vision = gcloud.vision;
```
#### Using the Cloud Vision API module

@@ -536,20 +599,116 @@

## Cloud Bigtable (Alpha)
## Google BigQuery (Beta)
- [API Documentation][gcloud-bigtable-docs]
- [Official Documentation][cloud-bigtable-docs]
- [API Documentation][gcloud-bigquery-docs]
- [Official Documentation][cloud-bigquery-docs]
*You may need to [create a cluster][cloud-bigtable-cluster] to use the Cloud Bigtable API with your project.*
#### Using the all-in-one module
#### Using the BigQuery API module
```
$ npm install --save google-cloud
$ npm install --save @google-cloud/bigquery
```
```js
var gcloud = require('google-cloud');
var bigtable = gcloud.bigtable;
var bigquery = require('@google-cloud/bigquery');
```
#### Preview
```js
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).
var bigqueryClient = bigquery({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
// Access an existing dataset and table.
var schoolsDataset = bigqueryClient.dataset('schools');
var schoolsTable = schoolsDataset.table('schoolsData');
// Import data into a table.
schoolsTable.import('/local/file.json', function(err, job) {});
// Get results from a query job.
var job = bigqueryClient.job('job-id');
// Use a callback.
job.getQueryResults(function(err, rows) {});
// Or get the same results as a readable stream.
job.getQueryResults().on('data', function(row) {});
```
## Google Stackdriver Logging (Beta)
- [API Documentation][gcloud-logging-docs]
- [Official Documentation][cloud-logging-docs]
#### Using the Google Stackdriver Logging API module
```
$ npm install --save @google-cloud/logging
```
```js
var logging = require('@google-cloud/logging');
```
#### Preview
```js
// Authenticating on a global-basis. You can also authenticate on a per-API-
// basis (see Authentication section above).
var loggingClient = logging({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
// Create a sink using a Bucket as a destination.
var gcs = storage();
loggingClient.createSink('my-new-sink', {
destination: gcs.bucket('my-sink')
}, function(err, sink) {});
// Write a critical entry to a log.
var syslog = loggingClient.log('syslog');
var metadata = {
resource: {
type: 'gce_instance',
labels: {
zone: 'global',
instance_id: '3'
}
}
};
var entry = syslog.entry(metadata, {
delegate: process.env.user
});
syslog.critical(entry, function(err) {});
// Get all entries in your project.
loggingClient.getEntries(function(err, entries) {
if (!err) {
// `entries` contains all of the entries from the logs in your project.
}
});
```
## Cloud Bigtable (Alpha)
- [API Documentation][gcloud-bigtable-docs]
- [Official Documentation][cloud-bigtable-docs]
*You may need to [create a cluster][cloud-bigtable-cluster] to use the Cloud Bigtable API with your project.*
#### Using the Cloud Bigtable API module

@@ -613,13 +772,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var dns = gcloud.dns;
```
#### Using the Cloud DNS API module

@@ -668,84 +816,2 @@

## Cloud Natural Language (Alpha)
- [API Documentation][gcloud-language-docs]
- [Official Documentation][cloud-language-docs]
#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var language = gcloud.language;
```
#### Using the Natural Language API module
```
$ npm install --save @google-cloud/language
```
```js
var language = require('@google-cloud/language');
```
#### Preview
```js
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authorization section above).
var languageClient = language({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
// Get the entities from a sentence.
languageClient.detectEntities('Stephen of Michigan!', function(err, entities) {
// entities = {
// people: ['Stephen'],
// places: ['Michigan']
// }
});
// Create a document if you plan to run multiple detections.
var document = languageClient.document('Contributions welcome!');
// Analyze the sentiment of the document.
document.detectSentiment(function(err, sentiment) {
// sentiment = 100 // Large numbers represent more positive sentiments.
});
// Parse the syntax of the document.
document.annotate(function(err, annotations) {
// annotations = {
// language: 'en',
// sentiment: 100,
// entities: {},
// sentences: ['Contributions welcome!'],
// tokens: [
// {
// text: 'Contributions',
// partOfSpeech: 'Noun (common and proper)',
// partOfSpeechTag: 'NOUN'
// },
// {
// text: 'welcome',
// partOfSpeech: 'Verb (all tenses and modes)',
// partOfSpeechTag: 'VERB'
// },
// {
// text: '!',
// partOfSpeech: 'Punctuation',
// partOfSpeechTag: 'PUNCT'
// }
// ]
// }
});
```
## Cloud Pub/Sub (Alpha)

@@ -756,13 +822,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var pubsub = gcloud.pubsub;
```
#### Using the Cloud Pub/Sub API module

@@ -815,13 +870,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var resource = gcloud.resource;
```
#### Using the Cloud Resource Manager API module

@@ -869,13 +913,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var spanner = gcloud.spanner;
```
#### Using the Cloud Spanner API module

@@ -961,13 +994,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var speech = gcloud.speech;
```
#### Using the Cloud Speech API module

@@ -1040,71 +1062,2 @@

## Cloud Translation API (Alpha)
- [API Documentation][gcloud-translate-docs]
- [Official Documentation][cloud-translate-docs]
#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var translate = gcloud.translate;
```
#### Using the Google Translate API module
```
$ npm install --save @google-cloud/translate
```
```js
var translate = require('@google-cloud/translate');
```
#### Preview
```js
// Authenticating on a per-API-basis. You don't need to do this if you auth on a
// global basis (see Authentication section above).
var translateClient = translate({
projectId: 'grape-spaceship-123',
keyFilename: '/path/to/keyfile.json'
});
// Translate a string of text.
translateClient.translate('Hello', 'es', function(err, translation) {
if (!err) {
// translation = 'Hola'
}
});
// Detect a language from a string of text.
translateClient.detect('Hello', function(err, results) {
if (!err) {
// results = {
// language: 'en',
// confidence: 1,
// input: 'Hello'
// }
}
});
// Get a list of supported languages.
translateClient.getLanguages(function(err, languages) {
if (!err) {
// languages = [
// 'af',
// 'ar',
// 'az',
// ...
// ]
}
});
```
## Google Compute Engine (Alpha)

@@ -1115,13 +1068,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var compute = gcloud.compute;
```
#### Using the Compute Engine API module

@@ -1170,13 +1112,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var prediction = gcloud.prediction;
```
#### Using the Prediction API module

@@ -1245,13 +1176,2 @@

#### Using the all-in-one module
```
$ npm install --save google-cloud
```
```js
var gcloud = require('google-cloud');
var monitoring = gcloud.monitoring;
```
#### Using the Google Stackdriver Monitoring API module

@@ -1281,9 +1201,13 @@

Please note it is currently under active development. Any release versioned 0.x.y is subject to backwards incompatible changes at any time.
Please note it is currently under active development. Any release versioned `0.x.y` is subject to backwards-incompatible changes at any time.
**Beta**: Libraries defined at a Beta quality level are expected to be mostly stable and we're working towards their release candidate. We will address issues and requests with a higher priority.
**GA**: Libraries defined at the GA (general availability) quality level are stable. The code surface will not change in backwards-incompatible ways unless absolutely necessary (e.g. because of critical security issues) or with an extensive deprecation period. Issues and requests against GA libraries are addressed with the highest priority.
**Alpha**: Libraries defined at an Alpha quality level are still a work-in-progress and are more likely to get backwards-incompatible updates.
Please note that the auto-generated portions of the GA libraries (the ones in modules such as `v1` or `v2`) are considered to be of **Beta** quality, even if the libraries that wrap them are GA.
**Beta**: Libraries defined at the Beta quality level are expected to be mostly stable, while we work towards their release candidate. We will address issues and requests with a higher priority.
**Alpha**: Libraries defined at the Alpha quality level are still a work-in-progress and are more likely to get backwards-incompatible updates.
## Contributing

@@ -1290,0 +1214,0 @@

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc