File tree Expand file tree Collapse file tree 5 files changed +1389
-1
lines changed Expand file tree Collapse file tree 5 files changed +1389
-1
lines changed Original file line number Diff line number Diff line change 16
16
" functions/stackdriver-logging" ,
17
17
" functions/firestore-export" ,
18
18
" management" ,
19
- " messaging"
19
+ " messaging" ,
20
+ " storage"
20
21
],
21
22
"version" : " 1.0.0"
22
23
}
Original file line number Diff line number Diff line change
1
+ const admin = require ( 'firebase-admin' ) ;
2
+
3
+ function initDefaultBucket ( ) {
4
+ // [START storage_init_default_bucket]
5
+ const admin = require ( "firebase-admin" ) ;
6
+
7
+ const serviceAccount = require ( "./path/to/serviceAccountKey.json" ) ;
8
+
9
+ admin . initializeApp ( {
10
+ credential : admin . credential . cert ( serviceAccount ) ,
11
+ storageBucket : "<BUCKET_NAME>.appspot.com"
12
+ } ) ;
13
+
14
+ const bucket = admin . storage ( ) . bucket ( ) ;
15
+
16
+ // 'bucket' is an object defined in the @google-cloud/storage library.
17
+ // See https://googlecloudplatform.github.io/google-cloud-node/#/docs/storage/latest/storage/bucket
18
+ // for more details.
19
+ // [END storage_init_default_bucket]
20
+ }
21
+
22
+ function customBucket ( ) {
23
+ // [START storage_custom_bucket]
24
+ const bucket = admin . storage ( ) . bucket ( "my-custom-bucket" ) ;
25
+ // [END storage_custom_bucket]
26
+ }
27
+
28
+ function customApp ( ) {
29
+ const customApp = admin . initializeApp ( {
30
+ // ...
31
+ } , "custom" ) ;
32
+
33
+ // [START storage_custom_app]
34
+ const bucket = customApp . storage ( ) . bucket ( ) ;
35
+ // [END storage_custom_app]
36
+ }
You can’t perform that action at this time.
0 commit comments