-
Notifications
You must be signed in to change notification settings - Fork 2.2k
docs(changelog): update storage documentation #1650
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
Conversation
docs/storage/storage.md
Outdated
| ---------|--------------------| | ||
| `snapshotChanges(): Observable<FirebaseStorage.UploadTaskSnapshot>` | Emits the raw `UploadTaskSnapshot` as the file upload progresses. | | ||
| `percentageChanges(): Observable<number>` | Emits the upload completion percentage. | | ||
| `getDownloadURL(): Observable<string>` | Emits the download url when available | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not on task any longer; might want to point out it's on the ref.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd updated the example with a more thorough description of this change, moreover, I've noticed that the type of the Observable changed to getDownloadURL(): Observable<any>
, instead of getDownloadURL(): Observable<string>
, thus I've matched the new declaration at the docs. storage ref - line 7
docs/storage/storage.md
Outdated
// observe percentage changes | ||
this.uploadPercent = task.percentageChanges(); | ||
// get notified when the download URL is available | ||
this.downloadURL = task.downloadURL(); | ||
this.downloadURL = fileRef.getDownloadURL(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You'll need to wait for task to finish, see Jeff's comment for a good solution #1649 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Even though I've added Jeff's example, on my tests I was only able to retrieve the url by actually subscribing to the Observable that receives the data from the getDownloadURL()
function inside the finalize method.
There's an example
import { finalize } from 'rxjs/operators';
// ...
task
.snapshotChanges()
.pipe(
finalize(() => {
this.downloadURL = storageRef.getDownloadURL()
this.downloadURL.subscribe(ref => {
this.update(this.user, ref)
})
})
)
.subscribe()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
Thanks for taking a pass on this, just a couple small things. |
Checklist
yarn install
,yarn test
run successfully? yes (yes/no; required)Description
Updating the documentation with examples on how to upload files through the methods, put, putString and upload.
Code sample