docs(changelog): update storage documentation#1650
Conversation
| | ---------|--------------------| | ||
| | `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.
Not on task any longer; might want to point out it's on the ref.
There was a problem hiding this comment.
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
| 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.
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.
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()
|
Thanks for taking a pass on this, just a couple small things. |
Checklist
yarn install,yarn testrun 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