@textile/hub > Buckets > pullIpfsPath
Buckets.pullIpfsPath() method
pullIpfsPath pulls the path from a remote UnixFS dag, writing it to writer if it's a file.
Signature:
pullIpfsPath(path: string, options?: {
progress?: (num?: number) => void;
}): AsyncIterableIterator<Uint8Array>;
Parameters
Parameter | Type | Description |
---|---|---|
path | string | A file/object (sub)-path within a bucket. |
options | { progress?: (num?: number) => void; } |
Returns:
AsyncIterableIterator<Uint8Array>
Example
Pull a file by its IPFS path and console.log the progress.
import { Buckets } from '@textile/hub'
const pullFile = async (buckets: Buckets, path: string) => {
const display = (num?: number) => {
console.log('Progress:', num)
}
buckets.pullIpfsPath(path, {progress: display})
}