Skip to content

Commit 38a2287

Browse files
committed
Merge branch 'master' into feature/presence
* master: Updated README for storage
2 parents 51dc8b6 + df82209 commit 38a2287

File tree

1 file changed

+20
-1
lines changed

1 file changed

+20
-1
lines changed

README.md

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ If the `storageBucket` key is passed as a configuration option, this method is a
479479
We can upload a file using the `uploadFile()` method. Using the `uploadFile()` method, we can set the name of the destination file, the path where we want to store it, as well as any metadata along with the file.
480480

481481
```javascript
482-
firestack.uploadFile(`photos/${auth.user.uid}/${filename}`, path, {
482+
firestack.storage.uploadFile(`photos/${auth.user.uid}/${filename}`, path, {
483483
contentType: 'image/jpeg',
484484
contentEncoding: 'base64',
485485
})
@@ -546,6 +546,19 @@ takePicture() {
546546
}
547547
```
548548

549+
#### downloadUrl()
550+
551+
The `downloadUrl()` method allows us to fetch the URL from the storage obejct in Firebase. It's defined on the `storageRef` object and can be used like so:
552+
553+
```javascript
554+
const storageRef = data.firestack.storage.ref('photos/photo.jpg');
555+
storageRef.downloadUrl()
556+
.then(res => {
557+
// res is an object that contains
558+
// the `url` as well as the path to the file in `path`
559+
})
560+
```
561+
549562
### Realtime Database
550563

551564
#### database attribute
@@ -568,6 +581,12 @@ Firestack attempts to provide the same API as the JS Firebase library for both A
568581

569582
// TODO: Finish documenting
570583

584+
#### onDisconnect()
585+
586+
Firebase provides a nice platform for defining presence. Firestack allows us to handle this as well using the `onDisconnect()` event.
587+
588+
589+
571590
### ServerValue
572591

573592
Firebase provides some static values based upon the server. We can use the `ServerValue` constant to retrieve these. For instance, to grab the TIMESTAMP on the server, use the `TIMESTAMP` value:

0 commit comments

Comments
 (0)