py-ipld-car
Content Addressable aRchive format reader and writer.
Install
pip install ipld_car
Usage
import ipld_car
from multiformats import multihash, CID
data = bytes([1, 2, 3])
digest = multihash.digest(data, "sha2-256")
cid = CID("base32", 1, "raw", digest)
block = (cid, data)
# encode a CAR file
car = ipld_car.encode([block[0]], [block])
print("CAR: ")
print(" " + str(car.tobytes()))
# decode a CAR file
roots, blocks = ipld_car.decode(car)
print("===")
print("Roots:")
for r in roots:
print(" " + r.encode("base32"))
print("Blocks:")
for b in blocks:
print(" CID: " + b[0].encode("base32"))
print(" Bytes: " + str(b[1].tobytes()))
# Output:
#
# CAR:
# b":\xa2eroots\x81\xd8*X%\x00\x01U\x12 \x03\x90X\xc6\xf2\xc0\xcbI,S;\nM\x14\xefw\xcc\x0fx\xab\xcc\xce\xd5(}\x84\xa1\xa2\x01\x1c\xfb\x81gversion\x01'\x01U\x12 \x03\x90X\xc6\xf2\xc0\xcbI,S;\nM\x14\xefw\xcc\x0fx\xab\xcc\xce\xd5(}\x84\xa1\xa2\x01\x1c\xfb\x81\x01\x02\x03"
# ===
# Roots:
# bafkreiadsbmmn4waznesyuz3bjgrj33xzqhxrk6mz3ksq7meugrachh3qe
# Blocks:
# CID: bafkreiadsbmmn4waznesyuz3bjgrj33xzqhxrk6mz3ksq7meugrachh3qe
# Bytes: b'\x01\x02\x03'
Contributing
All welcome! storacha.network is open-source.
License
Dual-licensed under Apache-2.0 OR MIT
Metadata
Release files for ipld-car 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ipld_car-0.0.1.tar.gz | 7.9 kB | Without provenance | Details for ipld_car-0.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipld_car-0.0.1-py3-none-any.whl | Python 3 | none | any | Details for ipld_car-0.0.1-py3-none-any.whl |
Total release size: 15.5 kB
Release files / ipld_car-0.0.1.tar.gz
| Download URL | ipld_car-0.0.1.tar.gz |
|---|---|
| Size | 7.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d6257f18f6f69ea83a72ae1309c48ac38977b969cfb93b7e9a95508892c54043
|
|
BLAKE2b-256 checksum How to use checksums |
205fd75282394109d41e95af847c7373292f7b526e34e21d6c6d65e5521233e2
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Release files / ipld_car-0.0.1-py3-none-any.whl
| Download URL | ipld_car-0.0.1-py3-none-any.whl |
|---|---|
| Size | 7.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
13cbc192a4e21b906d0f9c8b10506ca9332ead6091ad1ae8fe4d6f2415864477
|
|
BLAKE2b-256 checksum How to use checksums |
c246c223e8f8f492df8c688073f7df4fa32cf525781907c8237b5eb9abcf1546
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.2
|
Security for ipld-car 0.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.