Example: Including traversal path above the root in a CAR
The includeTraversalBlocks option will include the traversal blocks in the
CAR when they would otherwise be excluded (for example when the traversal
starts in a parent of the export root).
Here baz is the CID for baz.txt.
The CAR file will include the blocks for parent, /foo, /bar, and
/baz.txt.
@helia/carprovidesimportandexportmethods to read/write Car files to Helia's blockstore.See the Car interface for all available operations.
By default it supports
dag-pb,dag-cbor,dag-jsonandrawCIDs, more esoteric DAG walkers can be passed as an init option.Example: Exporting a DAG as a CAR file
Example: Exporting a part of a UnixFS DAG as a CAR file
Here the graph traversal will start at
rootand include the blocks forroot,/foo,/bar, and all the blocks that make upbaz.txt.If there are other files/directories in the UnixFS DAG under
root, they will not be included.rootwill be the only entry in the CAR file roots.Example: Including traversal path above the root in a CAR
The
includeTraversalBlocksoption will include the traversal blocks in the CAR when they would otherwise be excluded (for example when the traversal starts in a parent of the export root).Here
bazis the CID forbaz.txt.The CAR file will include the blocks for
parent,/foo,/bar, and/baz.txt.bazwill be the only entry in the CAR file roots.Example: Importing all blocks from a CAR file