CAR reader

The CAR format (Content Addressable aRchives) can be used to store content addressable objects in the form of IPLD block data as a sequence of bytes; typically in a file with a .car filename extension.

The CAR format is intended as a serialized representation of any IPLD DAG (graph) as the concatenation of its blocks, plus a header that describes the graphs in the file (via root CIDs). The requirement for the blocks in a CAR to form coherent DAGs is not strict, so the CAR format may also be used to store arbitrary IPLD blocks.

Specification for v1: https://ipld.io/specs/transport/car/carv1/

class atproto_core.car.CAR(root: CID, blocks: Dict[CID, dict])

Bases: object

CAR file.

property blocks: Dict[CID, dict]

Get blocks.

classmethod from_bytes(data: bytes) CAR

Decode CAR file.

Note

You could pass as data response of client.com.atproto.sync.get_repo, for example. And other responses of methods in the sync namespace.

Example

>>> from atproto import CAR, Client
>>> client = Client()
>>> client.login('my-handle', 'my-password')
>>> repo = client.com.atproto.sync.get_repo({'did': client.me.did})
>>> car_file = CAR.from_bytes(repo)
>>> print(car_file.root)
>>> print(car_file.blocks)
Parameters:

data – Content of the CAR file.

Returns:

Parsed CAR file.

Return type:

atproto.CAR

property root: CID

Get root.