@@ -27,6 +27,7 @@ import Task = FirebaseStorageTypes.Task;
27
27
import ListOptions = FirebaseStorageTypes . ListOptions ;
28
28
import SettableMetadata = FirebaseStorageTypes . SettableMetadata ;
29
29
import EmulatorMockTokenOptions = FirebaseStorageTypes . EmulatorMockTokenOptions ;
30
+ import StringFormat = FirebaseStorageTypes . StringFormat ;
30
31
import FirebaseApp = ReactNativeFirebase . FirebaseApp ;
31
32
32
33
export const StringFormat : FirebaseStorageTypes . StringFormat ;
@@ -37,10 +38,11 @@ export const TaskState: FirebaseStorageTypes.TaskState;
37
38
* Returns the existing default {@link Storage} instance that is associated with the
38
39
* default {@link FirebaseApp}. The default storage bucket is used. If no instance exists, initializes a new
39
40
* instance with default settings.
40
- *
41
+ * @param app - Firebase app to get FirebaseStorage instance for.
42
+ * @param bucketUrl - The gs:// url to your Firebase Storage Bucket. If not passed, uses the app's default Storage Bucket.
41
43
* @returns The {@link Storage} instance of the provided app.
42
44
*/
43
- export declare function getStorage ( ) : Storage ;
45
+ export declare function getStorage ( app ?: FirebaseApp , bucketUrl ?: string ) : Storage ;
44
46
45
47
/**
46
48
* Returns the existing default {@link Storage} instance that is associated with the
@@ -99,18 +101,22 @@ export function deleteObject(storageRef: Reference): Promise<void>;
99
101
/**
100
102
* Retrieves the blob at the given reference's location. Throws an error if the object is not found.
101
103
* @param storageRef - The {@link Reference} to the object.
104
+ * @param maxDownloadSizeBytes - Optional. Maximum size in bytes to retrieve.
102
105
* @returns A promise resolving to the Blob.
103
106
*/
104
- export function getBlob ( storageRef : Reference ) : Promise < Blob > ;
107
+ export function getBlob ( storageRef : Reference , maxDownloadSizeBytes ?: number ) : Promise < Blob > ;
105
108
106
109
/**
107
110
* Retrieves bytes (up to the specified max size) from an object at the given reference's location.
108
111
* Throws an error if the object is not found or if the size exceeds the maximum allowed.
109
112
* @param storageRef - The {@link Reference} to the object.
110
- * @param maxDownloadSizeBytes - Maximum size in bytes to retrieve.
113
+ * @param maxDownloadSizeBytes - Optional. Maximum size in bytes to retrieve.
111
114
* @returns A promise resolving to an ArrayBuffer.
112
115
*/
113
- export function getBytes ( storageRef : Reference , maxDownloadSizeBytes : number ) : Promise < ArrayBuffer > ;
116
+ export function getBytes (
117
+ storageRef : Reference ,
118
+ maxDownloadSizeBytes ?: number ,
119
+ ) : Promise < ArrayBuffer > ;
114
120
115
121
/**
116
122
* Retrieves a long-lived download URL for the object at the given reference's location.
@@ -129,12 +135,12 @@ export function getMetadata(storageRef: Reference): Promise<FullMetadata>;
129
135
/**
130
136
* Retrieves a readable stream for the object at the given reference's location. This API is only available in Node.js.
131
137
* @param storageRef - The {@link Reference} to the object.
132
- * @param maxDownloadSizeBytes - Maximum size in bytes to retrieve.
138
+ * @param maxDownloadSizeBytes - Optional. Maximum size in bytes to retrieve.
133
139
* @returns A NodeJS ReadableStream.
134
140
*/
135
141
export function getStream (
136
142
storageRef : Reference ,
137
- maxDownloadSizeBytes : number ,
143
+ maxDownloadSizeBytes ? : number ,
138
144
) : NodeJS . ReadableStream ;
139
145
140
146
/**
@@ -200,7 +206,7 @@ export function uploadBytesResumable(
200
206
export function uploadString (
201
207
storageRef : Reference ,
202
208
data : string ,
203
- format ?: 'raw' | 'base64' | 'base64url' | 'data_url' ,
209
+ format ?: StringFormat ,
204
210
metadata ?: SettableMetadata ,
205
211
) : Task ;
206
212
0 commit comments