UNPKG

1.82 kBJavaScriptView Raw
1/*! firebase-admin v10.0.0 */
2"use strict";
3/*!
4 * Copyright 2020 Google Inc.
5 *
6 * Licensed under the Apache License, Version 2.0 (the "License");
7 * you may not use this file except in compliance with the License.
8 * You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing, software
13 * distributed under the License is distributed on an "AS IS" BASIS,
14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 * See the License for the specific language governing permissions and
16 * limitations under the License.
17 */
18Object.defineProperty(exports, "__esModule", { value: true });
19exports.getStorage = void 0;
20/**
21 * Cloud Storage for Firebase.
22 *
23 * @packageDocumentation
24 */
25var app_1 = require("../app");
26var storage_1 = require("./storage");
27var storage_2 = require("./storage");
28Object.defineProperty(exports, "Storage", { enumerable: true, get: function () { return storage_2.Storage; } });
29/**
30 * Gets the {@link Storage} service for the default app or a given app.
31 *
32 * `getStorage()` can be called with no arguments to access the default
33 * app's `Storage` service or as `getStorage(app)` to access the
34 * `Storage` service associated with a specific app.
35 *
36 * @example
37 * ```javascript
38 * // Get the Storage service for the default app
39 * const defaultStorage = getStorage();
40 * ```
41 *
42 * @example
43 * ```javascript
44 * // Get the Storage service for a given app
45 * const otherStorage = getStorage(otherApp);
46 * ```
47 */
48function getStorage(app) {
49 if (typeof app === 'undefined') {
50 app = app_1.getApp();
51 }
52 var firebaseApp = app;
53 return firebaseApp.getOrInitService('storage', function (app) { return new storage_1.Storage(app); });
54}
55exports.getStorage = getStorage;