CarWriter class

Append-only writer for CAR v1 and v2 archives.

Constructors

CarWriter({required List<CID> roots, bool v2 = false, bool index = false, bool multihashIndex = false, int maxBlockSize = 32 * 1024 * 1024})
Creates a writer for a CAR archive with the given roots.

Properties

hashCode → int
The hash code for this object.
no setterinherited
index → bool
Whether to build an index (CAR v2 only).
final
maxBlockSize → int
Maximum allowed block size in bytes.
final
multihashIndex → bool
Whether the index should be MultihashIndexSorted (0x0401) instead of IndexSorted (0x0400).
final
roots → List<CID>
The root CIDs of the CAR.
final
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
v2 → bool
Whether to write a CAR v2 file.
final

Methods

close() → Future<Uint8List>
Emits the complete file as bytes.
closeStream() → Stream<Uint8List>
Emits the complete file as a stream of byte chunks.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited
write(CID cid, Uint8List block) → Future<void>
Writes a single section.

Operators

operator ==(Object other) → bool
The equality operator.
inherited

Static Methods

headerOnlyCar(CID root) → Future<Uint8List>
Builds a header-only CAR v1 archive whose single root is root.