Skip to content

Commit 6788743

Browse files
committed
chore: update README
1 parent 3c662f2 commit 6788743

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

README.md

+8-4
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ Deletes an object with the given key, if one exists.
263263
await store.delete('my-key')
264264
```
265265

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[] }>`
267267

268268
Returns a list of blobs in a given store.
269269

@@ -285,7 +285,8 @@ console.log(blobs)
285285
```
286286

287287
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.
289290

290291
Take the following list of keys as an example:
291292

@@ -327,15 +328,18 @@ console.log(directories)
327328
To drill down into a directory and get a list of its items, you can use the directory name as the `prefix` value.
328329

329330
```javascript
330-
const { blobs, directories } = await store.list({ directories: true, prefix: 'mice/' })
331+
const { blobs, directories } = await store.list({ directories: true, prefix: 'cats/' })
331332

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" } ]
333334
console.log(blobs)
334335

335336
// [ ]
336337
console.log(directories)
337338
```
338339

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+
339343
## Contributing
340344

341345
Contributions are welcome! If you encounter any issues or have suggestions for improvements, please open an issue or

0 commit comments

Comments
 (0)