-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
storage: add promise support #1697
storage: add promise support #1697
Conversation
// Promises are also supported by omitting callbacks. | ||
bucket.upload('/photos/zoo/zebra.jpg').then(function(data) { | ||
var file = data[0]; | ||
}); |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -53,6 +53,11 @@ localReadStream.pipe(remoteWriteStream); | |||
bucket.upload('/photos/zoo/zebra.jpg').then(function(data) { | |||
var file = data[0]; | |||
}); | |||
|
|||
// It's also possible to integrate with third-party Promise libraries. |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
Breaking changes ahead!⚠️
Summary of changes
The following methods previously returned a
stream
in the event that thecallback
parameter was omitted. This functionality has since moved to a different method entirely.Storage#getBuckets
->Storage#getBucketsStream
Bucket#getFiles
->Bucket#getFilesStream
Each callback accepting change has also been updated to return a
Promise
instance in the event that thecallback
was omitted.