@textile/hub > Buckets > movePath
Buckets.movePath() method
Move a file or subpath to a new path.
Signature:
movePath(key: string, fromPath: string, toPath: string): Promise<void>;
Parameters
Parameter | Type | Description |
---|---|---|
key | string | Unique (IPNS compatible) identifier key for a bucket. |
fromPath | string | A file/object or subpath within a bucket. |
toPath | string | The path within a bucket to move fromPath to. |
Returns:
Promise<void>
Example
Push a file to the root of a bucket
import { Buckets } from '@textile/hub'
const moveToRoot = async (buckets: Buckets, key: string, fromPath: string) => {
return await buckets.movePath(key, fromPath, "")
}