@textile/hub > Buckets > listPathFlat
Buckets.listPathFlat() method
listPathRecursive returns a nested object of all paths (and info) in a bucket
Signature:
listPathFlat(key: string, path: string, dirs?: boolean, depth?: number): Promise<Array<string>>;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | Unique (IPNS compatible) identifier key for a bucket. |
path | string | A file/object (sub)-path within a bucket. |
dirs | boolean | (optional) if false will include only file paths |
depth | number | (optional) will walk the entire bucket to target depth (default = 1) |
Returns:
Promise<Array<string>>
Example
import { Buckets } from '@textile/hub'
async function printPaths(buckets: Buckets, bucketKey: string) {
const list = await buckets.listPathFlat(bucketKey, '')
console.log(list)
}
// [
// '.textileseed',
// 'dir1',
// 'dir1/file1.jpg',
// 'path',
// 'path/to',
// 'path/to/file2.jpg'
// ]