File tree Expand file tree Collapse file tree 3 files changed +91
-3
lines changed Expand file tree Collapse file tree 3 files changed +91
-3
lines changed Load Diff This file was deleted.
Original file line number Diff line number Diff line change 1+
2+ # Storage
3+
4+ Firestack mimics the [ Web Firebase SDK Storage] ( https://firebase.google.com/docs/storage/web/start ) , whilst
5+ providing some iOS and Android specific functionality.
6+
7+ All Storage operations are accessed via ` storage() ` .
8+
9+ ## Uploading files
10+
11+ ### Simple
12+
13+ ``` javascript
14+ firestack .storage ()
15+ .ref (' /files/1234' )
16+ .putFile (' /path/to/file/1234' )
17+ .then (uploadedFile => {
18+ // success
19+ })
20+ .catch (err => {
21+ // Error
22+ });
23+ ```
24+
25+ ### Listen to upload state
26+
27+ ``` javascript
28+ const unsubscribe = firestack .storage ()
29+ .ref (' /files/1234' )
30+ .putFile (' /path/to/file/1234' )
31+ .on (' state_changed' , snapshot => {
32+ // Current upload state
33+ }, err => {
34+ // Error
35+ unsubscribe ();
36+ }, uploadedFile => {
37+ // Success
38+ unsubscribe ();
39+ });
40+ ```
41+
42+ ## Downloading files
43+
44+ ### Simple
45+
46+ ``` javascript
47+ firestack .storage ()
48+ .ref (' /files/1234' )
49+ .downloadFile (' /path/to/save/file' )
50+ .then (downloadedFile => {
51+ // success
52+ })
53+ .catch (err => {
54+ // Error
55+ });
56+ ```
57+
58+ ### Listen to download state
59+
60+ ``` javascript
61+ const unsubscribe = firestack .storage ()
62+ .ref (' /files/1234' )
63+ .downloadFile (' /path/to/save/file' )
64+ .on (' state_changed' , snapshot => {
65+ // Current download state
66+ }, err => {
67+ // Error
68+ unsubscribe ();
69+ }, downloadedFile => {
70+ // Success
71+ unsubscribe ();
72+ });
73+ ```
74+
75+ ## TODO
76+
77+ There are a few methods which have not yet been implemented for Storage:
78+
79+ ### Reference
80+ - put()
81+ - putString()
82+
83+ ### UploadTask
84+ - cancel()
85+ - pause()
86+ - resume()
87+
88+ ### DownloadTask
89+ - cancel()
90+ - pause()
91+ - resume()
Original file line number Diff line number Diff line change @@ -66,8 +66,6 @@ export default class StorageRef extends ReferenceBase {
6666 }
6767
6868 //Additional methods compared to Web API
69-
70- //TODO: Listeners
7169 /**
7270 * Downloads a reference to the device
7371 * @param {String } filePath Where to store the file
You can’t perform that action at this time.
0 commit comments