@google-cloud/resource v0.3.0
stephenplusplus
released this
17 Oct 23:15
·
22392 commits
to main
since this release
Updating
$ npm install @google-cloud/resource@0.3.0
⚠️ Breaking Changes
Promises have arrived!
It's been a long time coming, but we're finally here. We've shipped promise support in the Google Cloud Resource Manager 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 resource = require('@google-cloud/resource')();
resource.getProjects()
.then(function(data) {
var projects = 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 resource = require('@google-cloud/resource')();
- resource.getProjects()
+ resource.getProjectsStream()
.on('data', function(project) {})