Skip to content

Commit 01cebff

Browse files
committed
Storage get started
1 parent 895f1fa commit 01cebff

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

storage/index.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,44 @@
11
import firebase from "firebase/app";
22
import "firebase/storage";
33

4+
function initialize() {
5+
// [START storage_initialize]
6+
// Set the configuration for your app
7+
// TODO: Replace with your app's config object
8+
var firebaseConfig = {
9+
apiKey: '<your-api-key>',
10+
authDomain: '<your-auth-domain>',
11+
databaseURL: '<your-database-url>',
12+
storageBucket: '<your-storage-bucket-url>'
13+
};
14+
firebase.initializeApp(firebaseConfig);
15+
16+
// Get a reference to the storage service, which is used to create references in your storage bucket
17+
var storage = firebase.storage();
18+
// [END storage_initialize]
19+
}
20+
21+
function multipleBuckets() {
22+
// [START storage_multiple_buckets]
23+
// Get a non-default Storage bucket
24+
var storage = firebase.app().storage("gs://my-custom-bucket");
25+
// [END storage_multiple_buckets]
26+
}
27+
28+
function storageCustomApp() {
29+
const customApp = firebase.initializeApp({
30+
// ... custom stuff
31+
});
32+
33+
// [START storage_custom_app]
34+
// Get the default bucket from a custom firebase.app.App
35+
var storage = customApp.storage();
36+
37+
// Get a non-default bucket from a custom firebase.app.App
38+
var storage = customApp.storage("gs://my-custom-bucket");
39+
// [END storage_custom_app]
40+
}
41+
442
/**
543
* @param {File} file
644
*/

0 commit comments

Comments
 (0)