@textile/hub > Buckets > setPath
Buckets.setPath() method
Pushes a file to a bucket path.
Signature:
setPath(key: string, path: string, cid: string): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | Unique (IPNS compatible) identifier key for a bucket. |
path | string | A file/object (sub)-path within a bucket. |
cid | string | The IPFS cid of the dag to set at the path. |
Returns:
Promise<void>
Example
Push a file to the root of a bucket
import { Buckets } from '@textile/hub'
const pushRoot = async (buckets: Buckets, key: string, cid: string) => {
return await buckets.setPath(key, '/', cid)
}