Traverses a DAG containing UnixFS directories
A root CID may be specified to begin traversal from, otherwise the root currently being exported will be used.
In this example, the UnixFS path /foo/bar/baz.txt path should be resolvable beneath the root CID.
/foo/bar/baz.txt
root
import { createHelia } from 'helia'import { car, UnixFSPath } from '@helia/car'import { CID } from 'multiformats/cid'const helia = await createHelia()const c = car(helia)const root = CID.parse('QmRoot')for await (const buf of c.export(root, { traversal: new UnixFSPath('/foo/bar/baz.txt')})) { // do something with `buf`} Copy
import { createHelia } from 'helia'import { car, UnixFSPath } from '@helia/car'import { CID } from 'multiformats/cid'const helia = await createHelia()const c = car(helia)const root = CID.parse('QmRoot')for await (const buf of c.export(root, { traversal: new UnixFSPath('/foo/bar/baz.txt')})) { // do something with `buf`}
In this example, the root CID should be resolvable at the UnixFS path beneath parentCID.
parentCID
import { createHelia } from 'helia'import { car, UnixFSPath } from '@helia/car'import { CID } from 'multiformats/cid'const helia = await createHelia()const c = car(helia)const root = CID.parse('QmRoot')const parentCID = CID.parse('QmParent')for await (const buf of c.export(root, { traversal: new UnixFSPath(parentCID, '/foo/bar/baz.txt')})) { // do something with `buf`} Copy
import { createHelia } from 'helia'import { car, UnixFSPath } from '@helia/car'import { CID } from 'multiformats/cid'const helia = await createHelia()const c = car(helia)const root = CID.parse('QmRoot')const parentCID = CID.parse('QmParent')for await (const buf of c.export(root, { traversal: new UnixFSPath(parentCID, '/foo/bar/baz.txt')})) { // do something with `buf`}
Traverse the DAG and yield the next CID to traverse
Optional
Traverses a DAG containing UnixFS directories
A root CID may be specified to begin traversal from, otherwise the root currently being exported will be used.
Example: Begin traversal from the root being exported
In this example, the UnixFS path
/foo/bar/baz.txt
path should be resolvable beneath theroot
CID.Example: Begin traversal from a parent node
In this example, the
root
CID should be resolvable at the UnixFS path beneathparentCID
.