Skip to content

Commit

Permalink
Merge branch 'cloud-iot-core' of https://github.com/GoogleCloudPlatfo…
Browse files Browse the repository at this point in the history
…rm/nodejs-docs-samples into cloud-iot-core
  • Loading branch information
gguuss committed May 23, 2017
2 parents 3dafcec + bfa66db commit 6d9bafc
Show file tree
Hide file tree
Showing 12 changed files with 218 additions and 169 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ on Google Cloud Platform.
Create local credentials by running the following command and following the
oauth2 flow (read more about the command [here][auth_command]):

gcloud beta auth application-default login
gcloud auth application-default login

In non-Google Cloud environments, GCE instances created without the
correct scopes, or local workstations where the
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
},
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.14",
"@google-cloud/storage": "1.1.0",
"@google-cloud/storage": "1.1.1",
"ava": "0.19.1",
"nyc": "10.3.2",
"shelljs": "0.7.7"
Expand Down
11 changes: 4 additions & 7 deletions storage/encryption.js
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,12 @@ function downloadEncryptedFile (bucketName, srcFilename, destFilename, key) {
destination: destFilename
};

const file = storage
.bucket(bucketName)
.file(srcFilename);

file.setEncryptionKey(Buffer.from(key, 'base64'));

// Descrypts and downloads the file. This can only be done with the key used
// to encrypt and upload the file.
file
storage
.bucket(bucketName)
.file(srcFilename)
.setEncryptionKey(Buffer.from(key, 'base64'))
.download(options)
.then(() => {
console.log(`File ${srcFilename} downloaded to ${destFilename}.`);
Expand Down
4 changes: 2 additions & 2 deletions storage/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "npm run unit-test && npm run system-test"
},
"dependencies": {
"@google-cloud/storage": "1.1.0",
"@google-cloud/storage": "1.1.1",
"googleapis": "19.0.0",
"moment": "2.18.1",
"safe-buffer": "5.0.1",
Expand All @@ -28,7 +28,7 @@
"devDependencies": {
"@google-cloud/nodejs-repo-tools": "1.4.14",
"ava": "0.19.1",
"proxyquire": "1.7.11",
"proxyquire": "1.8.0",
"sinon": "2.2.0",
"uuid": "3.0.1"
},
Expand Down
73 changes: 15 additions & 58 deletions storage/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@
string-format-obj "^1.1.0"
through2 "^2.0.3"

"@google-cloud/[email protected].13":
version "1.4.13"
resolved "https://registry.yarnpkg.com/@google-cloud/nodejs-repo-tools/-/nodejs-repo-tools-1.4.13.tgz#005556d8b93cb29f16018988e466cf0f9dc6d91f"
"@google-cloud/[email protected].14":
version "1.4.14"
resolved "https://registry.yarnpkg.com/@google-cloud/nodejs-repo-tools/-/nodejs-repo-tools-1.4.14.tgz#b778687bcd798ea172a01d2b92db43ad95a8b0ce"
dependencies:
ava "0.19.1"
colors "1.1.2"
Expand All @@ -76,9 +76,9 @@
supertest "3.0.0"
yargs "8.0.1"

"@google-cloud/[email protected].0":
version "1.1.0"
resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-1.1.0.tgz#5e905a1aed4c196d5ce75dcdb5e4cd7ce29a0860"
"@google-cloud/[email protected].1":
version "1.1.1"
resolved "https://registry.yarnpkg.com/@google-cloud/storage/-/storage-1.1.1.tgz#6590b5ce6e779556c9cc7043bd6449d6bc0781de"
dependencies:
"@google-cloud/common" "^0.13.0"
arrify "^1.0.0"
Expand Down Expand Up @@ -774,10 +774,6 @@ camelcase@^2.0.0:
version "2.1.1"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-2.1.1.tgz#7c1d16d679a1bbe59ca02cacecfb011e201f5a1f"

camelcase@^3.0.0:
version "3.0.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-3.0.0.tgz#32fc4b9fcdaf845fcdf7e73bb97cac2261f0ab0a"

camelcase@^4.0.0, camelcase@^4.1.0:
version "4.1.0"
resolved "https://registry.yarnpkg.com/camelcase/-/camelcase-4.1.0.tgz#d545635be1e33c542649c69173e5de6acfae34dd"
Expand Down Expand Up @@ -2523,12 +2519,6 @@ os-homedir@^1.0.0:
version "1.0.2"
resolved "https://registry.yarnpkg.com/os-homedir/-/os-homedir-1.0.2.tgz#ffbc4988336e0e833de0c168c7ef152121aa7fb3"

os-locale@^1.4.0:
version "1.4.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-1.4.0.tgz#20f9f17ae29ed345e8bde583b13d2009803c14d9"
dependencies:
lcid "^1.0.0"

os-locale@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/os-locale/-/os-locale-2.0.0.tgz#15918ded510522b81ee7ae5a309d54f639fc39a4"
Expand Down Expand Up @@ -2746,6 +2736,14 @@ [email protected]:
module-not-found-error "^1.0.0"
resolve "~1.1.7"

[email protected]:
version "1.8.0"
resolved "https://registry.yarnpkg.com/proxyquire/-/proxyquire-1.8.0.tgz#02d514a5bed986f04cbb2093af16741535f79edc"
dependencies:
fill-keys "^1.0.2"
module-not-found-error "^1.0.0"
resolve "~1.1.7"

pseudomap@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/pseudomap/-/pseudomap-1.0.2.tgz#f052a28da70e618917ef0a8ac34c1ae5a68286b3"
Expand Down Expand Up @@ -3110,19 +3108,6 @@ signal-exit@^3.0.0, signal-exit@^3.0.2:
version "3.0.2"
resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.2.tgz#b5fdc08f1287ea1178628e415e25132b73646c6d"

[email protected]:
version "2.1.0"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.1.0.tgz#e057a9d2bf1b32f5d6dd62628ca9ee3961b0cafb"
dependencies:
diff "^3.1.0"
formatio "1.2.0"
lolex "^1.6.0"
native-promise-only "^0.8.1"
path-to-regexp "^1.7.0"
samsam "^1.1.3"
text-encoding "0.6.4"
type-detect "^4.0.0"

[email protected]:
version "2.2.0"
resolved "https://registry.yarnpkg.com/sinon/-/sinon-2.2.0.tgz#3b1b42ff5defcbf51a52a62aca6d61171b9fd262"
Expand Down Expand Up @@ -3242,7 +3227,7 @@ string-template@~1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/string-template/-/string-template-1.0.0.tgz#9e9f2233dc00f218718ec379a28a5673ecca8b96"

string-width@^1.0.1, string-width@^1.0.2:
string-width@^1.0.1:
version "1.0.2"
resolved "https://registry.yarnpkg.com/string-width/-/string-width-1.0.2.tgz#118bdf5b8cdc51a2a7e70d211e07e2b0b9b107d3"
dependencies:
Expand Down Expand Up @@ -3535,10 +3520,6 @@ [email protected]:
dependencies:
extsprintf "1.0.2"

which-module@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-1.0.0.tgz#bba63ca861948994ff307736089e3b96026c2a4f"

which-module@^2.0.0:
version "2.0.0"
resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a"
Expand Down Expand Up @@ -3631,36 +3612,12 @@ yallist@^2.0.0:
version "2.1.2"
resolved "https://registry.yarnpkg.com/yallist/-/yallist-2.1.2.tgz#1c11f9218f076089a47dd512f93c6699a6a81d52"

yargs-parser@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-5.0.0.tgz#275ecf0d7ffe05c77e64e7c86e4cd94bf0e1228a"
dependencies:
camelcase "^3.0.0"

yargs-parser@^7.0.0:
version "7.0.0"
resolved "https://registry.yarnpkg.com/yargs-parser/-/yargs-parser-7.0.0.tgz#8d0ac42f16ea55debd332caf4c4038b3e3f5dfd9"
dependencies:
camelcase "^4.1.0"

[email protected]:
version "7.1.0"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-7.1.0.tgz#6ba318eb16961727f5d284f8ea003e8d6154d0c8"
dependencies:
camelcase "^3.0.0"
cliui "^3.2.0"
decamelize "^1.1.1"
get-caller-file "^1.0.1"
os-locale "^1.4.0"
read-pkg-up "^1.0.1"
require-directory "^2.1.1"
require-main-filename "^1.0.1"
set-blocking "^2.0.0"
string-width "^1.0.2"
which-module "^1.0.0"
y18n "^3.2.1"
yargs-parser "^5.0.0"

[email protected]:
version "8.0.1"
resolved "https://registry.yarnpkg.com/yargs/-/yargs-8.0.1.tgz#420ef75e840c1457a80adcca9bc6fa3849de51aa"
Expand Down
38 changes: 19 additions & 19 deletions video/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,27 @@

# Google Cloud Video Intelligence API Node.js Samples

The [Cloud Video Intelligence API][video_docs] allows developers to easily
integrate video analysis within applications, including video labeling, safe search
, and shot change detection.
[![Build](https://storage.googleapis.com/cloud-docs-samples-badges/GoogleCloudPlatform/nodejs-docs-samples/nodejs-docs-samples-videointelligence.svg)]()

[video_docs]: https://cloud.google.com/video-intelligence/docs/
The [Cloud Video Intelligence API](https://cloud.google.com/video-intelligence) allows developers to use Google video analysis technology as part of their applications.

## Table of Contents

* [Setup](#setup)
* [Samples](#samples)
* [Analyze](#analyze)
* [Video Intelligence](#video-intelligence)
* [Running the tests](#running-the-tests)

## Setup

1. Read [Prerequisites][prereq] and [How to run a sample][run] first.
1. Install dependencies:

With `npm`:
With **npm**:

npm install

With `yarn`:
With **yarn**:

yarn install

Expand All @@ -33,45 +31,47 @@ integrate video analysis within applications, including video labeling, safe sea

## Samples

### Analyze
### Video Intelligence

View the [documentation][analyze_docs] or the [source code][analyze_code].
View the [documentation][video_0_docs] or the [source code][video_0_code].

__Usage:__ `node analyze.js --help`

```
Commands:
faces <gcsUri> Analyzes faces in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.
shots <gcsUri> Analyzes shot angles in a video stored in Google Cloud Storage using the Cloud Video
Intelligence API.
labels-gcs <gcsUri> Labels objects in a video stored in Google Cloud Storage using the Cloud Video Intelligence API.
labels-file <gcsUri> Labels objects in a video stored locally using the Cloud Video Intelligence API.
safe-search <gcsUri> Detects adult content in a video stored in Google Cloud Storage.
Options:
--help Show help [boolean]
Examples:
node analyze.js shots gs://my-bucket/my-video.mp4
node analyze.js labels-gcs gs://my-bucket/my-video.mp4
node analyze.js labels-file my-video.mp4
node analyze.js unsafe-content gs://my-bucket/my-video.mp4
node analyze.js faces gs://demomaker/volleyball_court.mp4
node analyze.js shots gs://demomaker/volleyball_court.mp4
node analyze.js labels-gcs gs://demomaker/volleyball_court.mp4
node analyze.js labels-file cat.mp4
node analyze.js safe-search gs://demomaker/volleyball_court.mp4
For more information, see https://cloud.google.com/video-intelligence/docs
```

[analyze_docs]: https://cloud.google.com/video-intelligence/docs
[analyze_code]: analyze.js
[video_0_docs]: https://cloud.google.com/video-intelligence/docs
[video_0_code]: analyze.js

## Running the tests

1. Set the `GCLOUD_PROJECT` and `GOOGLE_APPLICATION_CREDENTIALS` environment
variables.
1. Set the **GCLOUD_PROJECT** and **GOOGLE_APPLICATION_CREDENTIALS** environment variables.

1. Run the tests:

With `npm`:
With **npm**:

npm test

With `yarn`:
With **yarn**:

yarn test
Loading

0 comments on commit 6d9bafc

Please sign in to comment.