@@ -263,7 +263,7 @@ Deletes an object with the given key, if one exists.
263
263
await store .delete (' my-key' )
264
264
```
265
265
266
- ### ` list(options?: { cursor?: string, paginate?: boolean. prefix?: string }): Promise<{ blobs: BlobResult[], directories: string[] }> `
266
+ ### ` list(options?: { cursor?: string, directories?: boolean, paginate?: boolean. prefix?: string }): Promise<{ blobs: BlobResult[], directories: string[] }> `
267
267
268
268
Returns a list of blobs in a given store.
269
269
@@ -285,7 +285,8 @@ console.log(blobs)
285
285
```
286
286
287
287
Optionally, you can choose to group blobs together under a common prefix and then browse them hierarchically when
288
- listing a store. To do this, use the ` / ` character in your keys to group them into multiple levels.
288
+ listing a store, just like grouping files in a directory. To do this, use the ` / ` character in your keys to group them
289
+ into directories.
289
290
290
291
Take the following list of keys as an example:
291
292
@@ -327,15 +328,18 @@ console.log(directories)
327
328
To drill down into a directory and get a list of its items, you can use the directory name as the ` prefix ` value.
328
329
329
330
``` javascript
330
- const { blobs , directories } = await store .list ({ directories: true , prefix: ' mice /' })
331
+ const { blobs , directories } = await store .list ({ directories: true , prefix: ' cats /' })
331
332
332
- // [ { etag: "etag3 ", key: "mice/jerry .jpg" }, { etag: "etag4 ", key: "mice/mickey .jpg" } ]
333
+ // [ { etag: "etag1 ", key: "cats/garfield .jpg" }, { etag: "etag2 ", key: "cats/tom .jpg" } ]
333
334
console .log (blobs)
334
335
335
336
// [ ]
336
337
console .log (directories)
337
338
```
338
339
340
+ Note that we're only interested in entries under the ` cats ` directory, which is why we're using a trailing slash.
341
+ Without it, other keys like ` catsuit ` would also match.
342
+
339
343
## Contributing
340
344
341
345
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or
0 commit comments