Skip to content

Commit 1952112

Browse files
authored
Add missing storage snippets (firebase#104)
1 parent 25f5a82 commit 1952112

File tree

4 files changed

+30
-6
lines changed

4 files changed

+30
-6
lines changed

snippets/storage-next/index/storage_custom_app.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,11 @@
44
// To make edits to the snippets in this file, please edit the source
55

66
// [START storage_custom_app_modular]
7-
// TODO: Snippet not yet written...
7+
import { getStorage } from "firebase/storage";
8+
9+
// Get the default bucket from a custom firebase.app.App
10+
const storage1 = getStorage(customApp);
11+
12+
// Get a non-default bucket from a custom firebase.app.App
13+
const storage2 = getStorage(customApp, "gs://my-custom-bucket");
814
// [END storage_custom_app_modular]

snippets/storage-next/index/storage_initialize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
// [START storage_initialize_modular]
77
import { initializeApp } from "firebase/app";
8-
import { getStorage, uploadBytesResumable } from "firebase/storage";
8+
import { getStorage } from "firebase/storage";
99

1010
// Set the configuration for your app
1111
// TODO: Replace with your app's config object

snippets/storage-next/index/storage_multiple_buckets.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,8 @@
44
// To make edits to the snippets in this file, please edit the source
55

66
// [START storage_multiple_buckets_modular]
7-
// TODO: Snippet not yet written...
7+
import { getStorage } from "firebase/storage";
8+
9+
// Get a non-default Storage bucket
10+
const storage = getStorage(firebaseApp, "gs://my-custom-bucket");
811
// [END storage_multiple_buckets_modular]

storage-next/index.js

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const firebaseApp = initializeApp({
1212
function initialize() {
1313
// [START storage_initialize]
1414
const { initializeApp } = require("firebase/app");
15-
const { getStorage, uploadBytesResumable } = require("firebase/storage");
15+
const { getStorage } = require("firebase/storage");
1616

1717
// Set the configuration for your app
1818
// TODO: Replace with your app's config object
@@ -31,13 +31,28 @@ function initialize() {
3131

3232
function multipleBuckets() {
3333
// [START storage_multiple_buckets]
34-
// TODO: Snippet not yet written...
34+
const { getStorage } = require("firebase/storage");
35+
36+
// Get a non-default Storage bucket
37+
const storage = getStorage(firebaseApp, "gs://my-custom-bucket");
3538
// [END storage_multiple_buckets]
3639
}
3740

3841
function storageCustomApp() {
42+
const { initializeApp } = require("firebase/app");
43+
44+
const customApp = initializeApp({
45+
// ... custom stuff
46+
});
47+
3948
// [START storage_custom_app]
40-
// TODO: Snippet not yet written...
49+
const { getStorage } = require("firebase/storage");
50+
51+
// Get the default bucket from a custom firebase.app.App
52+
const storage1 = getStorage(customApp);
53+
54+
// Get a non-default bucket from a custom firebase.app.App
55+
const storage2 = getStorage(customApp, "gs://my-custom-bucket");
4156
// [END storage_custom_app]
4257
}
4358

0 commit comments

Comments
 (0)