whitespace
This commit is contained in:
parent
96b4a47a52
commit
0f11da0e0b
|
@ -9,14 +9,14 @@ providing some iOS and Android specific functionality.
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
firebase.storage()
|
firebase.storage()
|
||||||
.ref('/files/1234')
|
.ref('/files/1234')
|
||||||
.putFile('/path/to/file/1234')
|
.putFile('/path/to/file/1234')
|
||||||
.then(uploadedFile => {
|
.then(uploadedFile => {
|
||||||
//success
|
//success
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
//Error
|
//Error
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
@ -24,28 +24,28 @@ firebase.storage()
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const metadata = {
|
const metadata = {
|
||||||
contentType: 'image/jpeg'
|
contentType: 'image/jpeg'
|
||||||
}
|
}
|
||||||
firebase.storage()
|
firebase.storage()
|
||||||
.ref('/files/1234')
|
.ref('/files/1234')
|
||||||
.putFile('/path/to/file/1234', metadata)
|
.putFile('/path/to/file/1234', metadata)
|
||||||
```
|
```
|
||||||
|
|
||||||
### Listen to upload state
|
### Listen to upload state
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const unsubscribe = firebase.storage()
|
const unsubscribe = firebase.storage()
|
||||||
.ref('/files/1234')
|
.ref('/files/1234')
|
||||||
.putFile('/path/to/file/1234')
|
.putFile('/path/to/file/1234')
|
||||||
.on('state_changed', snapshot => {
|
.on('state_changed', snapshot => {
|
||||||
//Current upload state
|
//Current upload state
|
||||||
}, err => {
|
}, err => {
|
||||||
//Error
|
//Error
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
}, uploadedFile => {
|
}, uploadedFile => {
|
||||||
//Success
|
//Success
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## Downloading files
|
## Downloading files
|
||||||
|
@ -54,31 +54,31 @@ unsubscribe();
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
firebase.storage()
|
firebase.storage()
|
||||||
.ref('/files/1234')
|
.ref('/files/1234')
|
||||||
.downloadFile('/path/to/save/file')
|
.downloadFile('/path/to/save/file')
|
||||||
.then(downloadedFile => {
|
.then(downloadedFile => {
|
||||||
//success
|
//success
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
//Error
|
//Error
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
### Listen to download state
|
### Listen to download state
|
||||||
|
|
||||||
```javascript
|
```javascript
|
||||||
const unsubscribe = firebase.storage()
|
const unsubscribe = firebase.storage()
|
||||||
.ref('/files/1234')
|
.ref('/files/1234')
|
||||||
.downloadFile('/path/to/save/file')
|
.downloadFile('/path/to/save/file')
|
||||||
.on('state_changed', snapshot => {
|
.on('state_changed', snapshot => {
|
||||||
//Current download state
|
//Current download state
|
||||||
}, err => {
|
}, err => {
|
||||||
//Error
|
//Error
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
}, downloadedFile => {
|
}, downloadedFile => {
|
||||||
//Success
|
//Success
|
||||||
unsubscribe();
|
unsubscribe();
|
||||||
});
|
});
|
||||||
```
|
```
|
||||||
|
|
||||||
## TODO
|
## TODO
|
||||||
|
|
Loading…
Reference in New Issue