A library to interact with merkledags stored as a single file
This is a Go implementation of the CAR specifications, both CARv1 and CARv2.
Note that there are two major module versions:
go-car/v2is geared towards reading and writing CARv2 files, and also supports consuming CARv1 files and using CAR files as an IPFS blockstore.go-carv0, in the root directory, just supports reading and writing CARv1 files.
Most users should use v2, especially for new software, since the v2 API transparently supports both CAR formats.
CARv2 features:
- Generate index from an existing CARv1 file
- Wrap CARv1 files into a CARv2 with automatic index generation.
- Random-access to blocks in a CAR file given their CID via Read-Only blockstore API, with transparent support for both CARv1 and CARv2
- Write CARv2 files via Read-Write blockstore API, with support for appending blocks to an existing CARv2 file, and resumption from a partially written CARv2 files.
- Individual access to inner CARv1 data payload and index of a CARv2 file via the
ReaderAPI.
To install the latest version of go-car/v2 module, run:
go get github.com/ipld/go-car/v2Alternatively, to install the v0 module, run:
go get github.com/ipld/go-carSee docs on pkg.go.dev.
Here is a shortlist of other examples from the documentation
- Wrap an existing CARv1 file into an indexed CARv2 file
- Open read-only blockstore from a CAR file
- Open read-write blockstore from a CAR file
- Read the index from an existing CARv2 file
- Extract the index from a CARv2 file and store it as a separate file
PRs are welcome!
When editing the Readme, please conform to the standard-readme specification.
Apache-2.0/MIT © Protocol Labs