Packages

@google-cloud/vision

6.2.0 · 12 Oct 2026Apache-2.01.1M / weekRepositoryHomepagenpmAtom feed

Your version

0.21.0

18 Jul 2018Where it was published

0.25.0 is the newest release of 0.21.x.

In short

1 new4 changed

Release note

Updating

$ npm install --save gcloud@0.21.0

Breaking Changes

:warning: Stop listening for complete on your Storage streams

If you've uploaded or downloaded a file from your bucket, you may have noticed that we use the complete event to tell you when everything's officially done. This is because the module we use, request, uses it to give us the response body. We need that data to be sure your file was downloaded or uploaded successfully-- did the data you received or sent match the data the server has?

This was problematic and confusing: #340, #362, #423, #435, #436 #809. Users expected the end event with a readable stream and a finish event with a writable. That's just what we're used to with Node streams. And worse, an upload that we determined invalid would have still emitted "finish", in addition to "error".

We've just found a way to get around this: #824. If you're downloading a file, you'll get end only when we know the data is good. With an upload, you'll get finish only when we know the file was uploaded successfully.

:heavy_multiplication_x: Before

// Downloading
file.createReadStream()
  .pipe(fs.createWriteStream('local-copy.png'))
  .on('complete', function(metadata) {});

// Uploading
fs.createReadStream('local-file.png')
  .pipe(file.createWriteStream())
  .on('complete', function(metadata) {});

:heavy_check_mark: After

// Downloading
file.createReadStream()
  .pipe(fs.createWriteStream('local-copy.png'))
  .on('finish', function() {
    // metadata can now be found on the file: `file.metadata`
  });

// Uploading
fs.createReadStream('local-file.png')
  .pipe(file.createWriteStream())
  .on('end', function() {
    // metadata can now be found on the file: `file.metadata`
  });

:warning: Use File#getSignedUrl and File#getSignedPolicy? Check your dates

Issue
PR

Our documentation previously stated that we accepted seconds, but in the code, getSignedPolicy was expecting milliseconds. We noticed some inconsistency between the methods-- one wanted options.expires, another options.expiration, so we decided to simplify.

In both methods, we now accept options.expires with anything Date() accepts.

:heavy_multiplication_x: Before

file.getSignedPolicy({
  expiration: Date.now() + 60 * 60 * 24 * 14 // two weeks
}, function(err, policy) {});

file.getSignedUrl({
  action: 'read',
  expires: Date.now() + (1000 * 60 * 60 * 24 * 14) // two weeks
}, function(err, url) {});

:heavy_check_mark: After

file.getSignedPolicy({
  expires: '9-23-2015'
}, function(err, policy) {});

file.getSignedUrl({
  expires: '9-23-2015'
}, function(err, url) {});

Features

  • Storage (#819, #852): Start a resumable upload without writing data to it.

Node v4.0 support

From this release forward, Node v4.0 will be supported.

Share how you're using gcloud

This release brought a lot of changes. We move fast and have a lot more features coming soon, but we want to make sure what we support already is working as expected and find places where we can make improvements. We have an extensive test suite using both a simulated backend and the real thing, but it's still really important that we hear actual use cases. Because of them, our library has improved greatly already.

Look forward to hearing from you!

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.