@@ -206,15 +206,16 @@ export class Reference {
206
206
/**
207
207
* List all items (files) and prefixes (folders) under this storage reference.
208
208
*
209
- * It is a helper method for calling list() recursively until there is no
210
- * more results. The default pagination size is 200 .
209
+ * This is a helper method for calling list() repeatedly until there are no
210
+ * more results. The default pagination size is 1000 .
211
211
*
212
- * Note: the results may not be a consistent snapshot if objects are changed
212
+ * Note: The results may not be a consistent snapshot if objects are changed
213
213
* between paginating requests.
214
214
*
215
- * Warning: If there are
215
+ * Warning: listAll may potentially consume too many resources if there are
216
+ * too many results.
216
217
*
217
- * @return A promise that resolves with all the items and prefixes under
218
+ * @return A Promise that resolves with all the items and prefixes under
218
219
* the current storage reference. `prefixes` contains references to
219
220
* sub-directories and `items` contains references to objects in this
220
221
* folder. `nextPageToken` is never returned.
@@ -233,32 +234,28 @@ export class Reference {
233
234
pageToken ?: string
234
235
) : Promise < void > {
235
236
let opt : ListOptions = {
236
- maxResults : 1 ,
237
+ // maxResults is 1000 by default.
237
238
pageToken
238
239
} ;
239
240
const nextPage = await this . list ( opt ) ;
240
- Array . prototype . push . apply ( accumulator . prefixes , nextPage . prefixes ) ;
241
- Array . prototype . push . apply ( accumulator . items , nextPage . items ) ;
242
- if ( nextPage . nextPageToken ) {
241
+ accumulator . prefixes ( ... nextPage . prefixes ) ;
242
+ accumulator . items ( ... nextPage . items ) ;
243
+ if ( nextPage . nextPageToken === undefined ) {
243
244
await this . listAllHelper ( accumulator , nextPage . nextPageToken ) ;
244
245
}
245
246
}
246
247
247
248
/**
248
249
* List items (files) and prefixes (folders) under this storage reference.
249
250
*
250
- * GCS is a key-blob store. Firebase storage impose the semantic of '/'
251
+ * GCS is a key-blob store. Firebase Storage imposes the semantic of '/'
251
252
* delimited folder structure.
252
- * Objects whose paths, aside from the prefix, contain '/' will have
253
- * their path, truncated after the '/', returned in prefixes.
254
- * Duplicate prefixes are omitted.
255
- * Objects whose paths, aside from the prefix, do not contain '/' will
256
- * be returned in items.
253
+ * Refer to GCS's List API if you want to learn more.
257
254
*
258
- * Firebase storage does not support invalid object paths that end with
259
- * "/" or contain two consecutive "/"s. All invalid objects in GCS will be
260
- * filtered by GCS .
261
- * list() may fail if there are too many invalid objects in the bucket.
255
+ * To adhere to Firebase Rules's Semantics, Firebase storage does not
256
+ * support objects whose paths end with "/" or contain two consecutive
257
+ * "/"s. Firebase Storage List API will filter these unsupported objects .
258
+ * list() may fail if there are too many unsupported objects in the bucket.
262
259
*
263
260
* @param options.maxResults If set, limits the total number of `prefixes`
264
261
* and `items` to return. The default and maximum maxResults is 1000.
0 commit comments