Skip to content

@google-cloud/storage v0.3.0

Compare
Choose a tag to compare
@lukesneeringer lukesneeringer released this 25 Aug 04:25
· 1260 commits to main since this release

Updating

$ npm install @google-cloud/storage@0.3.0

⚠️ Breaking Changes

Promises have arrived!

Issue: googleapis/google-cloud-node#551
PR: googleapis/google-cloud-node#1697

It's been a long time coming, but we're finally here. We've shipped promise support in the Google Cloud Storage module!

Do I have to use promises?

Nope, carry on. (But keep reading if you use streams)

How do I use promises?

Don't pass a callback:

var gcs = require('@google-cloud/storage')();

gcs.getBuckets()
  .then(function(data) {
    var buckets = data[0];
  })
  .catch(function(err) {});

How do I use a method as a stream?

All of the streaming functionality from our methods have been moved to their own method.

var gcs = require('@google-cloud/storage')();
var bucket = gcs.bucket('my-bucket-name');

- gcs.getBuckets()
+ gcs.getBucketsStream()
    .on('data', function(bucket) {})

- bucket.getFiles()
+ bucket.getFilesStream()
  .on('data', function(file) {})