@firebase/storage 0.13.3 → 0.13.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.browser.cjs.js +3571 -3571
- package/dist/index.browser.cjs.js.map +1 -1
- package/dist/index.cjs.js +3571 -3571
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm2017.js +3571 -3571
- package/dist/index.esm2017.js.map +1 -1
- package/dist/index.node.cjs.js +3596 -3596
- package/dist/index.node.cjs.js.map +1 -1
- package/dist/node-esm/index.node.esm.js +3596 -3596
- package/dist/node-esm/index.node.esm.js.map +1 -1
- package/dist/node-esm/src/api.browser.d.ts +47 -47
- package/dist/node-esm/src/api.d.ts +200 -200
- package/dist/node-esm/src/api.node.d.ts +47 -47
- package/dist/node-esm/src/constants.d.ts +20 -20
- package/dist/node-esm/src/implementation/async.d.ts +22 -22
- package/dist/node-esm/src/implementation/backoff.d.ts +43 -43
- package/dist/node-esm/src/implementation/blob.d.ts +34 -34
- package/dist/node-esm/src/implementation/connection.d.ts +56 -56
- package/dist/node-esm/src/implementation/constants.d.ts +48 -48
- package/dist/node-esm/src/implementation/error.d.ts +126 -126
- package/dist/node-esm/src/implementation/failrequest.d.ts +29 -29
- package/dist/node-esm/src/implementation/fs.d.ts +17 -17
- package/dist/node-esm/src/implementation/json.d.ts +7 -7
- package/dist/node-esm/src/implementation/list.d.ts +19 -19
- package/dist/node-esm/src/implementation/location.d.ts +32 -32
- package/dist/node-esm/src/implementation/metadata.d.ts +40 -40
- package/dist/node-esm/src/implementation/observer.d.ts +47 -47
- package/dist/node-esm/src/implementation/path.d.ts +31 -31
- package/dist/node-esm/src/implementation/request.d.ts +47 -47
- package/dist/node-esm/src/implementation/requestinfo.d.ts +73 -73
- package/dist/node-esm/src/implementation/requests.d.ts +84 -84
- package/dist/node-esm/src/implementation/string.d.ts +73 -73
- package/dist/node-esm/src/implementation/taskenums.d.ts +77 -77
- package/dist/node-esm/src/implementation/type.d.ts +23 -23
- package/dist/node-esm/src/implementation/url.d.ts +22 -22
- package/dist/node-esm/src/implementation/utils.d.ts +23 -23
- package/dist/node-esm/src/index.d.ts +7 -7
- package/dist/node-esm/src/index.node.d.ts +7 -7
- package/dist/node-esm/src/list.d.ts +41 -41
- package/dist/node-esm/src/metadata.d.ts +27 -27
- package/dist/node-esm/src/platform/base64.d.ts +20 -20
- package/dist/node-esm/src/platform/browser/base64.d.ts +19 -19
- package/dist/node-esm/src/platform/browser/connection.d.ts +55 -55
- package/dist/node-esm/src/platform/connection.d.ts +22 -22
- package/dist/node-esm/src/platform/node/base64.d.ts +19 -19
- package/dist/node-esm/src/platform/node/connection.d.ts +58 -59
- package/dist/node-esm/src/public-types.d.ts +424 -424
- package/dist/node-esm/src/reference.d.ts +208 -208
- package/dist/node-esm/src/service.d.ts +130 -130
- package/dist/node-esm/src/task.d.ts +148 -148
- package/dist/node-esm/test/browser/blob.test.d.ts +17 -17
- package/dist/node-esm/test/browser/connection.test.d.ts +17 -17
- package/dist/node-esm/test/browser/string.browser.test.d.ts +17 -17
- package/dist/node-esm/test/integration/integration.test.d.ts +24 -24
- package/dist/node-esm/test/node/connection.test.d.ts +17 -17
- package/dist/node-esm/test/node/stream.test.d.ts +17 -17
- package/dist/node-esm/test/unit/connection.d.ts +47 -47
- package/dist/node-esm/test/unit/index.test.d.ts +4 -4
- package/dist/node-esm/test/unit/location.test.d.ts +1 -1
- package/dist/node-esm/test/unit/reference.test.d.ts +1 -1
- package/dist/node-esm/test/unit/request.test.d.ts +1 -1
- package/dist/node-esm/test/unit/requests.test.d.ts +1 -1
- package/dist/node-esm/test/unit/service.test.d.ts +1 -1
- package/dist/node-esm/test/unit/string.test.d.ts +1 -1
- package/dist/node-esm/test/unit/task.test.d.ts +1 -1
- package/dist/node-esm/test/unit/testshared.d.ts +60 -60
- package/dist/node-esm/test/unit/utils.test.d.ts +17 -17
- package/dist/src/api.browser.d.ts +47 -47
- package/dist/src/api.d.ts +200 -200
- package/dist/src/api.node.d.ts +47 -47
- package/dist/src/constants.d.ts +20 -20
- package/dist/src/implementation/async.d.ts +22 -22
- package/dist/src/implementation/backoff.d.ts +43 -43
- package/dist/src/implementation/blob.d.ts +34 -34
- package/dist/src/implementation/connection.d.ts +56 -56
- package/dist/src/implementation/constants.d.ts +48 -48
- package/dist/src/implementation/error.d.ts +126 -126
- package/dist/src/implementation/failrequest.d.ts +29 -29
- package/dist/src/implementation/fs.d.ts +17 -17
- package/dist/src/implementation/json.d.ts +7 -7
- package/dist/src/implementation/list.d.ts +19 -19
- package/dist/src/implementation/location.d.ts +32 -32
- package/dist/src/implementation/metadata.d.ts +40 -40
- package/dist/src/implementation/observer.d.ts +47 -47
- package/dist/src/implementation/path.d.ts +31 -31
- package/dist/src/implementation/request.d.ts +47 -47
- package/dist/src/implementation/requestinfo.d.ts +73 -73
- package/dist/src/implementation/requests.d.ts +84 -84
- package/dist/src/implementation/string.d.ts +73 -73
- package/dist/src/implementation/taskenums.d.ts +77 -77
- package/dist/src/implementation/type.d.ts +23 -23
- package/dist/src/implementation/url.d.ts +22 -22
- package/dist/src/implementation/utils.d.ts +23 -23
- package/dist/src/index.d.ts +7 -7
- package/dist/src/index.node.d.ts +7 -7
- package/dist/src/list.d.ts +41 -41
- package/dist/src/metadata.d.ts +27 -27
- package/dist/src/platform/base64.d.ts +20 -20
- package/dist/src/platform/browser/base64.d.ts +19 -19
- package/dist/src/platform/browser/connection.d.ts +55 -55
- package/dist/src/platform/connection.d.ts +22 -22
- package/dist/src/platform/node/base64.d.ts +19 -19
- package/dist/src/platform/node/connection.d.ts +58 -59
- package/dist/src/public-types.d.ts +424 -424
- package/dist/src/reference.d.ts +208 -208
- package/dist/src/service.d.ts +130 -130
- package/dist/src/task.d.ts +148 -148
- package/dist/test/browser/blob.test.d.ts +17 -17
- package/dist/test/browser/connection.test.d.ts +17 -17
- package/dist/test/browser/string.browser.test.d.ts +17 -17
- package/dist/test/integration/integration.test.d.ts +24 -24
- package/dist/test/node/connection.test.d.ts +17 -17
- package/dist/test/node/stream.test.d.ts +17 -17
- package/dist/test/unit/connection.d.ts +47 -47
- package/dist/test/unit/index.test.d.ts +4 -4
- package/dist/test/unit/location.test.d.ts +1 -1
- package/dist/test/unit/reference.test.d.ts +1 -1
- package/dist/test/unit/request.test.d.ts +1 -1
- package/dist/test/unit/requests.test.d.ts +1 -1
- package/dist/test/unit/service.test.d.ts +1 -1
- package/dist/test/unit/string.test.d.ts +1 -1
- package/dist/test/unit/task.test.d.ts +1 -1
- package/dist/test/unit/testshared.d.ts +60 -60
- package/dist/test/unit/utils.test.d.ts +17 -17
- package/package.json +6 -6
package/dist/src/api.d.ts
CHANGED
|
@@ -1,200 +1,200 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { FirebaseApp } from '@firebase/app';
|
|
18
|
-
import { StorageReference, FirebaseStorage, UploadResult, ListOptions, ListResult, UploadTask, SettableMetadata, UploadMetadata, FullMetadata } from './public-types';
|
|
19
|
-
import { Reference } from './reference';
|
|
20
|
-
import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
21
|
-
import { StringFormat } from './implementation/string';
|
|
22
|
-
export { EmulatorMockTokenOptions } from '@firebase/util';
|
|
23
|
-
export { StorageError, StorageErrorCode } from './implementation/error';
|
|
24
|
-
/**
|
|
25
|
-
* Public types.
|
|
26
|
-
*/
|
|
27
|
-
export * from './public-types';
|
|
28
|
-
export { Location as _Location } from './implementation/location';
|
|
29
|
-
export { UploadTask as _UploadTask } from './task';
|
|
30
|
-
export type { Reference as _Reference } from './reference';
|
|
31
|
-
export type { FirebaseStorageImpl as _FirebaseStorageImpl } from './service';
|
|
32
|
-
export { FbsBlob as _FbsBlob } from './implementation/blob';
|
|
33
|
-
export { dataFromString as _dataFromString } from './implementation/string';
|
|
34
|
-
export { invalidRootOperation as _invalidRootOperation, invalidArgument as _invalidArgument } from './implementation/error';
|
|
35
|
-
export { TaskEvent as _TaskEvent, TaskState as _TaskState } from './implementation/taskenums';
|
|
36
|
-
export { StringFormat };
|
|
37
|
-
/**
|
|
38
|
-
* Downloads the data at the object's location. Returns an error if the object
|
|
39
|
-
* is not found.
|
|
40
|
-
*
|
|
41
|
-
* To use this functionality, you have to whitelist your app's origin in your
|
|
42
|
-
* Cloud Storage bucket. See also
|
|
43
|
-
* https://cloud.google.com/storage/docs/configuring-cors
|
|
44
|
-
*
|
|
45
|
-
* @public
|
|
46
|
-
* @param ref - StorageReference where data should be downloaded.
|
|
47
|
-
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
48
|
-
* retrieve.
|
|
49
|
-
* @returns A Promise containing the object's bytes
|
|
50
|
-
*/
|
|
51
|
-
export declare function getBytes(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<ArrayBuffer>;
|
|
52
|
-
/**
|
|
53
|
-
* Uploads data to this object's location.
|
|
54
|
-
* The upload is not resumable.
|
|
55
|
-
* @public
|
|
56
|
-
* @param ref - {@link StorageReference} where data should be uploaded.
|
|
57
|
-
* @param data - The data to upload.
|
|
58
|
-
* @param metadata - Metadata for the data to upload.
|
|
59
|
-
* @returns A Promise containing an UploadResult
|
|
60
|
-
*/
|
|
61
|
-
export declare function uploadBytes(ref: StorageReference, data: Blob | Uint8Array | ArrayBuffer, metadata?: UploadMetadata): Promise<UploadResult>;
|
|
62
|
-
/**
|
|
63
|
-
* Uploads a string to this object's location.
|
|
64
|
-
* The upload is not resumable.
|
|
65
|
-
* @public
|
|
66
|
-
* @param ref - {@link StorageReference} where string should be uploaded.
|
|
67
|
-
* @param value - The string to upload.
|
|
68
|
-
* @param format - The format of the string to upload.
|
|
69
|
-
* @param metadata - Metadata for the string to upload.
|
|
70
|
-
* @returns A Promise containing an UploadResult
|
|
71
|
-
*/
|
|
72
|
-
export declare function uploadString(ref: StorageReference, value: string, format?: StringFormat, metadata?: UploadMetadata): Promise<UploadResult>;
|
|
73
|
-
/**
|
|
74
|
-
* Uploads data to this object's location.
|
|
75
|
-
* The upload can be paused and resumed, and exposes progress updates.
|
|
76
|
-
* @public
|
|
77
|
-
* @param ref - {@link StorageReference} where data should be uploaded.
|
|
78
|
-
* @param data - The data to upload.
|
|
79
|
-
* @param metadata - Metadata for the data to upload.
|
|
80
|
-
* @returns An UploadTask
|
|
81
|
-
*/
|
|
82
|
-
export declare function uploadBytesResumable(ref: StorageReference, data: Blob | Uint8Array | ArrayBuffer, metadata?: UploadMetadata): UploadTask;
|
|
83
|
-
/**
|
|
84
|
-
* A `Promise` that resolves with the metadata for this object. If this
|
|
85
|
-
* object doesn't exist or metadata cannot be retrieved, the promise is
|
|
86
|
-
* rejected.
|
|
87
|
-
* @public
|
|
88
|
-
* @param ref - {@link StorageReference} to get metadata from.
|
|
89
|
-
*/
|
|
90
|
-
export declare function getMetadata(ref: StorageReference): Promise<FullMetadata>;
|
|
91
|
-
/**
|
|
92
|
-
* Updates the metadata for this object.
|
|
93
|
-
* @public
|
|
94
|
-
* @param ref - {@link StorageReference} to update metadata for.
|
|
95
|
-
* @param metadata - The new metadata for the object.
|
|
96
|
-
* Only values that have been explicitly set will be changed. Explicitly
|
|
97
|
-
* setting a value to null will remove the metadata.
|
|
98
|
-
* @returns A `Promise` that resolves with the new metadata for this object.
|
|
99
|
-
*/
|
|
100
|
-
export declare function updateMetadata(ref: StorageReference, metadata: SettableMetadata): Promise<FullMetadata>;
|
|
101
|
-
/**
|
|
102
|
-
* List items (files) and prefixes (folders) under this storage reference.
|
|
103
|
-
*
|
|
104
|
-
* List API is only available for Firebase Rules Version 2.
|
|
105
|
-
*
|
|
106
|
-
* GCS is a key-blob store. Firebase Storage imposes the semantic of '/'
|
|
107
|
-
* delimited folder structure.
|
|
108
|
-
* Refer to GCS's List API if you want to learn more.
|
|
109
|
-
*
|
|
110
|
-
* To adhere to Firebase Rules's Semantics, Firebase Storage does not
|
|
111
|
-
* support objects whose paths end with "/" or contain two consecutive
|
|
112
|
-
* "/"s. Firebase Storage List API will filter these unsupported objects.
|
|
113
|
-
* list() may fail if there are too many unsupported objects in the bucket.
|
|
114
|
-
* @public
|
|
115
|
-
*
|
|
116
|
-
* @param ref - {@link StorageReference} to get list from.
|
|
117
|
-
* @param options - See {@link ListOptions} for details.
|
|
118
|
-
* @returns A `Promise` that resolves with the items and prefixes.
|
|
119
|
-
* `prefixes` contains references to sub-folders and `items`
|
|
120
|
-
* contains references to objects in this folder. `nextPageToken`
|
|
121
|
-
* can be used to get the rest of the results.
|
|
122
|
-
*/
|
|
123
|
-
export declare function list(ref: StorageReference, options?: ListOptions): Promise<ListResult>;
|
|
124
|
-
/**
|
|
125
|
-
* List all items (files) and prefixes (folders) under this storage reference.
|
|
126
|
-
*
|
|
127
|
-
* This is a helper method for calling list() repeatedly until there are
|
|
128
|
-
* no more results. The default pagination size is 1000.
|
|
129
|
-
*
|
|
130
|
-
* Note: The results may not be consistent if objects are changed while this
|
|
131
|
-
* operation is running.
|
|
132
|
-
*
|
|
133
|
-
* Warning: `listAll` may potentially consume too many resources if there are
|
|
134
|
-
* too many results.
|
|
135
|
-
* @public
|
|
136
|
-
* @param ref - {@link StorageReference} to get list from.
|
|
137
|
-
*
|
|
138
|
-
* @returns A `Promise` that resolves with all the items and prefixes under
|
|
139
|
-
* the current storage reference. `prefixes` contains references to
|
|
140
|
-
* sub-directories and `items` contains references to objects in this
|
|
141
|
-
* folder. `nextPageToken` is never returned.
|
|
142
|
-
*/
|
|
143
|
-
export declare function listAll(ref: StorageReference): Promise<ListResult>;
|
|
144
|
-
/**
|
|
145
|
-
* Returns the download URL for the given {@link StorageReference}.
|
|
146
|
-
* @public
|
|
147
|
-
* @param ref - {@link StorageReference} to get the download URL for.
|
|
148
|
-
* @returns A `Promise` that resolves with the download
|
|
149
|
-
* URL for this object.
|
|
150
|
-
*/
|
|
151
|
-
export declare function getDownloadURL(ref: StorageReference): Promise<string>;
|
|
152
|
-
/**
|
|
153
|
-
* Deletes the object at this location.
|
|
154
|
-
* @public
|
|
155
|
-
* @param ref - {@link StorageReference} for object to delete.
|
|
156
|
-
* @returns A `Promise` that resolves if the deletion succeeds.
|
|
157
|
-
*/
|
|
158
|
-
export declare function deleteObject(ref: StorageReference): Promise<void>;
|
|
159
|
-
/**
|
|
160
|
-
* Returns a {@link StorageReference} for the given url.
|
|
161
|
-
* @param storage - {@link FirebaseStorage} instance.
|
|
162
|
-
* @param url - URL. If empty, returns root reference.
|
|
163
|
-
* @public
|
|
164
|
-
*/
|
|
165
|
-
export declare function ref(storage: FirebaseStorage, url?: string): StorageReference;
|
|
166
|
-
/**
|
|
167
|
-
* Returns a {@link StorageReference} for the given path in the
|
|
168
|
-
* default bucket.
|
|
169
|
-
* @param storageOrRef - {@link FirebaseStorage} or {@link StorageReference}.
|
|
170
|
-
* @param pathOrUrlStorage - path. If empty, returns root reference (if {@link FirebaseStorage}
|
|
171
|
-
* instance provided) or returns same reference (if {@link StorageReference} provided).
|
|
172
|
-
* @public
|
|
173
|
-
*/
|
|
174
|
-
export declare function ref(storageOrRef: FirebaseStorage | StorageReference, path?: string): StorageReference;
|
|
175
|
-
/**
|
|
176
|
-
* @internal
|
|
177
|
-
*/
|
|
178
|
-
export declare function _getChild(ref: StorageReference, childPath: string): Reference;
|
|
179
|
-
/**
|
|
180
|
-
* Gets a {@link FirebaseStorage} instance for the given Firebase app.
|
|
181
|
-
* @public
|
|
182
|
-
* @param app - Firebase app to get {@link FirebaseStorage} instance for.
|
|
183
|
-
* @param bucketUrl - The gs:// url to your Firebase Storage Bucket.
|
|
184
|
-
* If not passed, uses the app's default Storage Bucket.
|
|
185
|
-
* @returns A {@link FirebaseStorage} instance.
|
|
186
|
-
*/
|
|
187
|
-
export declare function getStorage(app?: FirebaseApp, bucketUrl?: string): FirebaseStorage;
|
|
188
|
-
/**
|
|
189
|
-
* Modify this {@link FirebaseStorage} instance to communicate with the Cloud Storage emulator.
|
|
190
|
-
*
|
|
191
|
-
* @param storage - The {@link FirebaseStorage} instance
|
|
192
|
-
* @param host - The emulator host (ex: localhost)
|
|
193
|
-
* @param port - The emulator port (ex: 5001)
|
|
194
|
-
* @param options - Emulator options. `options.mockUserToken` is the mock auth
|
|
195
|
-
* token to use for unit testing Security Rules.
|
|
196
|
-
* @public
|
|
197
|
-
*/
|
|
198
|
-
export declare function connectStorageEmulator(storage: FirebaseStorage, host: string, port: number, options?: {
|
|
199
|
-
mockUserToken?: EmulatorMockTokenOptions | string;
|
|
200
|
-
}): void;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { StorageReference, FirebaseStorage, UploadResult, ListOptions, ListResult, UploadTask, SettableMetadata, UploadMetadata, FullMetadata } from './public-types';
|
|
19
|
+
import { Reference } from './reference';
|
|
20
|
+
import { EmulatorMockTokenOptions } from '@firebase/util';
|
|
21
|
+
import { StringFormat } from './implementation/string';
|
|
22
|
+
export { EmulatorMockTokenOptions } from '@firebase/util';
|
|
23
|
+
export { StorageError, StorageErrorCode } from './implementation/error';
|
|
24
|
+
/**
|
|
25
|
+
* Public types.
|
|
26
|
+
*/
|
|
27
|
+
export * from './public-types';
|
|
28
|
+
export { Location as _Location } from './implementation/location';
|
|
29
|
+
export { UploadTask as _UploadTask } from './task';
|
|
30
|
+
export type { Reference as _Reference } from './reference';
|
|
31
|
+
export type { FirebaseStorageImpl as _FirebaseStorageImpl } from './service';
|
|
32
|
+
export { FbsBlob as _FbsBlob } from './implementation/blob';
|
|
33
|
+
export { dataFromString as _dataFromString } from './implementation/string';
|
|
34
|
+
export { invalidRootOperation as _invalidRootOperation, invalidArgument as _invalidArgument } from './implementation/error';
|
|
35
|
+
export { TaskEvent as _TaskEvent, TaskState as _TaskState } from './implementation/taskenums';
|
|
36
|
+
export { StringFormat };
|
|
37
|
+
/**
|
|
38
|
+
* Downloads the data at the object's location. Returns an error if the object
|
|
39
|
+
* is not found.
|
|
40
|
+
*
|
|
41
|
+
* To use this functionality, you have to whitelist your app's origin in your
|
|
42
|
+
* Cloud Storage bucket. See also
|
|
43
|
+
* https://cloud.google.com/storage/docs/configuring-cors
|
|
44
|
+
*
|
|
45
|
+
* @public
|
|
46
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
47
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
48
|
+
* retrieve.
|
|
49
|
+
* @returns A Promise containing the object's bytes
|
|
50
|
+
*/
|
|
51
|
+
export declare function getBytes(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<ArrayBuffer>;
|
|
52
|
+
/**
|
|
53
|
+
* Uploads data to this object's location.
|
|
54
|
+
* The upload is not resumable.
|
|
55
|
+
* @public
|
|
56
|
+
* @param ref - {@link StorageReference} where data should be uploaded.
|
|
57
|
+
* @param data - The data to upload.
|
|
58
|
+
* @param metadata - Metadata for the data to upload.
|
|
59
|
+
* @returns A Promise containing an UploadResult
|
|
60
|
+
*/
|
|
61
|
+
export declare function uploadBytes(ref: StorageReference, data: Blob | Uint8Array | ArrayBuffer, metadata?: UploadMetadata): Promise<UploadResult>;
|
|
62
|
+
/**
|
|
63
|
+
* Uploads a string to this object's location.
|
|
64
|
+
* The upload is not resumable.
|
|
65
|
+
* @public
|
|
66
|
+
* @param ref - {@link StorageReference} where string should be uploaded.
|
|
67
|
+
* @param value - The string to upload.
|
|
68
|
+
* @param format - The format of the string to upload.
|
|
69
|
+
* @param metadata - Metadata for the string to upload.
|
|
70
|
+
* @returns A Promise containing an UploadResult
|
|
71
|
+
*/
|
|
72
|
+
export declare function uploadString(ref: StorageReference, value: string, format?: StringFormat, metadata?: UploadMetadata): Promise<UploadResult>;
|
|
73
|
+
/**
|
|
74
|
+
* Uploads data to this object's location.
|
|
75
|
+
* The upload can be paused and resumed, and exposes progress updates.
|
|
76
|
+
* @public
|
|
77
|
+
* @param ref - {@link StorageReference} where data should be uploaded.
|
|
78
|
+
* @param data - The data to upload.
|
|
79
|
+
* @param metadata - Metadata for the data to upload.
|
|
80
|
+
* @returns An UploadTask
|
|
81
|
+
*/
|
|
82
|
+
export declare function uploadBytesResumable(ref: StorageReference, data: Blob | Uint8Array | ArrayBuffer, metadata?: UploadMetadata): UploadTask;
|
|
83
|
+
/**
|
|
84
|
+
* A `Promise` that resolves with the metadata for this object. If this
|
|
85
|
+
* object doesn't exist or metadata cannot be retrieved, the promise is
|
|
86
|
+
* rejected.
|
|
87
|
+
* @public
|
|
88
|
+
* @param ref - {@link StorageReference} to get metadata from.
|
|
89
|
+
*/
|
|
90
|
+
export declare function getMetadata(ref: StorageReference): Promise<FullMetadata>;
|
|
91
|
+
/**
|
|
92
|
+
* Updates the metadata for this object.
|
|
93
|
+
* @public
|
|
94
|
+
* @param ref - {@link StorageReference} to update metadata for.
|
|
95
|
+
* @param metadata - The new metadata for the object.
|
|
96
|
+
* Only values that have been explicitly set will be changed. Explicitly
|
|
97
|
+
* setting a value to null will remove the metadata.
|
|
98
|
+
* @returns A `Promise` that resolves with the new metadata for this object.
|
|
99
|
+
*/
|
|
100
|
+
export declare function updateMetadata(ref: StorageReference, metadata: SettableMetadata): Promise<FullMetadata>;
|
|
101
|
+
/**
|
|
102
|
+
* List items (files) and prefixes (folders) under this storage reference.
|
|
103
|
+
*
|
|
104
|
+
* List API is only available for Firebase Rules Version 2.
|
|
105
|
+
*
|
|
106
|
+
* GCS is a key-blob store. Firebase Storage imposes the semantic of '/'
|
|
107
|
+
* delimited folder structure.
|
|
108
|
+
* Refer to GCS's List API if you want to learn more.
|
|
109
|
+
*
|
|
110
|
+
* To adhere to Firebase Rules's Semantics, Firebase Storage does not
|
|
111
|
+
* support objects whose paths end with "/" or contain two consecutive
|
|
112
|
+
* "/"s. Firebase Storage List API will filter these unsupported objects.
|
|
113
|
+
* list() may fail if there are too many unsupported objects in the bucket.
|
|
114
|
+
* @public
|
|
115
|
+
*
|
|
116
|
+
* @param ref - {@link StorageReference} to get list from.
|
|
117
|
+
* @param options - See {@link ListOptions} for details.
|
|
118
|
+
* @returns A `Promise` that resolves with the items and prefixes.
|
|
119
|
+
* `prefixes` contains references to sub-folders and `items`
|
|
120
|
+
* contains references to objects in this folder. `nextPageToken`
|
|
121
|
+
* can be used to get the rest of the results.
|
|
122
|
+
*/
|
|
123
|
+
export declare function list(ref: StorageReference, options?: ListOptions): Promise<ListResult>;
|
|
124
|
+
/**
|
|
125
|
+
* List all items (files) and prefixes (folders) under this storage reference.
|
|
126
|
+
*
|
|
127
|
+
* This is a helper method for calling list() repeatedly until there are
|
|
128
|
+
* no more results. The default pagination size is 1000.
|
|
129
|
+
*
|
|
130
|
+
* Note: The results may not be consistent if objects are changed while this
|
|
131
|
+
* operation is running.
|
|
132
|
+
*
|
|
133
|
+
* Warning: `listAll` may potentially consume too many resources if there are
|
|
134
|
+
* too many results.
|
|
135
|
+
* @public
|
|
136
|
+
* @param ref - {@link StorageReference} to get list from.
|
|
137
|
+
*
|
|
138
|
+
* @returns A `Promise` that resolves with all the items and prefixes under
|
|
139
|
+
* the current storage reference. `prefixes` contains references to
|
|
140
|
+
* sub-directories and `items` contains references to objects in this
|
|
141
|
+
* folder. `nextPageToken` is never returned.
|
|
142
|
+
*/
|
|
143
|
+
export declare function listAll(ref: StorageReference): Promise<ListResult>;
|
|
144
|
+
/**
|
|
145
|
+
* Returns the download URL for the given {@link StorageReference}.
|
|
146
|
+
* @public
|
|
147
|
+
* @param ref - {@link StorageReference} to get the download URL for.
|
|
148
|
+
* @returns A `Promise` that resolves with the download
|
|
149
|
+
* URL for this object.
|
|
150
|
+
*/
|
|
151
|
+
export declare function getDownloadURL(ref: StorageReference): Promise<string>;
|
|
152
|
+
/**
|
|
153
|
+
* Deletes the object at this location.
|
|
154
|
+
* @public
|
|
155
|
+
* @param ref - {@link StorageReference} for object to delete.
|
|
156
|
+
* @returns A `Promise` that resolves if the deletion succeeds.
|
|
157
|
+
*/
|
|
158
|
+
export declare function deleteObject(ref: StorageReference): Promise<void>;
|
|
159
|
+
/**
|
|
160
|
+
* Returns a {@link StorageReference} for the given url.
|
|
161
|
+
* @param storage - {@link FirebaseStorage} instance.
|
|
162
|
+
* @param url - URL. If empty, returns root reference.
|
|
163
|
+
* @public
|
|
164
|
+
*/
|
|
165
|
+
export declare function ref(storage: FirebaseStorage, url?: string): StorageReference;
|
|
166
|
+
/**
|
|
167
|
+
* Returns a {@link StorageReference} for the given path in the
|
|
168
|
+
* default bucket.
|
|
169
|
+
* @param storageOrRef - {@link FirebaseStorage} or {@link StorageReference}.
|
|
170
|
+
* @param pathOrUrlStorage - path. If empty, returns root reference (if {@link FirebaseStorage}
|
|
171
|
+
* instance provided) or returns same reference (if {@link StorageReference} provided).
|
|
172
|
+
* @public
|
|
173
|
+
*/
|
|
174
|
+
export declare function ref(storageOrRef: FirebaseStorage | StorageReference, path?: string): StorageReference;
|
|
175
|
+
/**
|
|
176
|
+
* @internal
|
|
177
|
+
*/
|
|
178
|
+
export declare function _getChild(ref: StorageReference, childPath: string): Reference;
|
|
179
|
+
/**
|
|
180
|
+
* Gets a {@link FirebaseStorage} instance for the given Firebase app.
|
|
181
|
+
* @public
|
|
182
|
+
* @param app - Firebase app to get {@link FirebaseStorage} instance for.
|
|
183
|
+
* @param bucketUrl - The gs:// url to your Firebase Storage Bucket.
|
|
184
|
+
* If not passed, uses the app's default Storage Bucket.
|
|
185
|
+
* @returns A {@link FirebaseStorage} instance.
|
|
186
|
+
*/
|
|
187
|
+
export declare function getStorage(app?: FirebaseApp, bucketUrl?: string): FirebaseStorage;
|
|
188
|
+
/**
|
|
189
|
+
* Modify this {@link FirebaseStorage} instance to communicate with the Cloud Storage emulator.
|
|
190
|
+
*
|
|
191
|
+
* @param storage - The {@link FirebaseStorage} instance
|
|
192
|
+
* @param host - The emulator host (ex: localhost)
|
|
193
|
+
* @param port - The emulator port (ex: 5001)
|
|
194
|
+
* @param options - Emulator options. `options.mockUserToken` is the mock auth
|
|
195
|
+
* token to use for unit testing Security Rules.
|
|
196
|
+
* @public
|
|
197
|
+
*/
|
|
198
|
+
export declare function connectStorageEmulator(storage: FirebaseStorage, host: string, port: number, options?: {
|
|
199
|
+
mockUserToken?: EmulatorMockTokenOptions | string;
|
|
200
|
+
}): void;
|
package/dist/src/api.node.d.ts
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2021 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
import { StorageReference } from './public-types';
|
|
18
|
-
/**
|
|
19
|
-
* Downloads the data at the object's location. Returns an error if the object
|
|
20
|
-
* is not found.
|
|
21
|
-
*
|
|
22
|
-
* To use this functionality, you have to whitelist your app's origin in your
|
|
23
|
-
* Cloud Storage bucket. See also
|
|
24
|
-
* https://cloud.google.com/storage/docs/configuring-cors
|
|
25
|
-
*
|
|
26
|
-
* This API is not available in Node.
|
|
27
|
-
*
|
|
28
|
-
* @public
|
|
29
|
-
* @param ref - StorageReference where data should be downloaded.
|
|
30
|
-
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
31
|
-
* retrieve.
|
|
32
|
-
* @returns A Promise that resolves with a Blob containing the object's bytes
|
|
33
|
-
*/
|
|
34
|
-
export declare function getBlob(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<Blob>;
|
|
35
|
-
/**
|
|
36
|
-
* Downloads the data at the object's location. Raises an error event if the
|
|
37
|
-
* object is not found.
|
|
38
|
-
*
|
|
39
|
-
* This API is only available in Node.
|
|
40
|
-
*
|
|
41
|
-
* @public
|
|
42
|
-
* @param ref - StorageReference where data should be downloaded.
|
|
43
|
-
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
44
|
-
* retrieve.
|
|
45
|
-
* @returns A stream with the object's data as bytes
|
|
46
|
-
*/
|
|
47
|
-
export declare function getStream(ref: StorageReference, maxDownloadSizeBytes?: number): ReadableStream;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2021 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
import { StorageReference } from './public-types';
|
|
18
|
+
/**
|
|
19
|
+
* Downloads the data at the object's location. Returns an error if the object
|
|
20
|
+
* is not found.
|
|
21
|
+
*
|
|
22
|
+
* To use this functionality, you have to whitelist your app's origin in your
|
|
23
|
+
* Cloud Storage bucket. See also
|
|
24
|
+
* https://cloud.google.com/storage/docs/configuring-cors
|
|
25
|
+
*
|
|
26
|
+
* This API is not available in Node.
|
|
27
|
+
*
|
|
28
|
+
* @public
|
|
29
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
30
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
31
|
+
* retrieve.
|
|
32
|
+
* @returns A Promise that resolves with a Blob containing the object's bytes
|
|
33
|
+
*/
|
|
34
|
+
export declare function getBlob(ref: StorageReference, maxDownloadSizeBytes?: number): Promise<Blob>;
|
|
35
|
+
/**
|
|
36
|
+
* Downloads the data at the object's location. Raises an error event if the
|
|
37
|
+
* object is not found.
|
|
38
|
+
*
|
|
39
|
+
* This API is only available in Node.
|
|
40
|
+
*
|
|
41
|
+
* @public
|
|
42
|
+
* @param ref - StorageReference where data should be downloaded.
|
|
43
|
+
* @param maxDownloadSizeBytes - If set, the maximum allowed size in bytes to
|
|
44
|
+
* retrieve.
|
|
45
|
+
* @returns A stream with the object's data as bytes
|
|
46
|
+
*/
|
|
47
|
+
export declare function getStream(ref: StorageReference, maxDownloadSizeBytes?: number): ReadableStream;
|
package/dist/src/constants.d.ts
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2020 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Type constant for Firebase Storage.
|
|
19
|
-
*/
|
|
20
|
-
export declare const STORAGE_TYPE = "storage";
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Type constant for Firebase Storage.
|
|
19
|
+
*/
|
|
20
|
+
export declare const STORAGE_TYPE = "storage";
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* @license
|
|
3
|
-
* Copyright 2017 Google LLC
|
|
4
|
-
*
|
|
5
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
-
* you may not use this file except in compliance with the License.
|
|
7
|
-
* You may obtain a copy of the License at
|
|
8
|
-
*
|
|
9
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
-
*
|
|
11
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
-
* See the License for the specific language governing permissions and
|
|
15
|
-
* limitations under the License.
|
|
16
|
-
*/
|
|
17
|
-
/**
|
|
18
|
-
* Returns a function that invokes f with its arguments asynchronously as a
|
|
19
|
-
* microtask, i.e. as soon as possible after the current script returns back
|
|
20
|
-
* into browser code.
|
|
21
|
-
*/
|
|
22
|
-
export declare function async(f: Function): Function;
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2017 Google LLC
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* Returns a function that invokes f with its arguments asynchronously as a
|
|
19
|
+
* microtask, i.e. as soon as possible after the current script returns back
|
|
20
|
+
* into browser code.
|
|
21
|
+
*/
|
|
22
|
+
export declare function async(f: Function): Function;
|