Validate what an IPFS gateway returns by decoding and validating the CAR block.
Usage
CARs can be read from memory or file and can be exported as a file/folder or byte stream
>>> import asyncio
>>> import aiohttp
...
>>> from ipfs_car_decoder import ChunkedMemoryByteStream, stream_bytes
...
>>> ipfs_hash = 'bafkreibm6jg3ux5qumhcn2b3flc3tyu6dmlb4xa7u5bf44yegnrjhc4yeq'
...
>>> async def test():
... stream = ChunkedMemoryByteStream()
... async with aiohttp.ClientSession() as session:
... async with session.get(f'https://ipfs.io/ipfs/{ipfs_hash}', headers={'Accept':'application/vnd.ipld.car'}) as resp:
... resp.raise_for_status()
... assert resp.content_type == 'application/vnd.ipld.car'
... async for chunk, _ in resp.content.iter_chunks():
... await stream.append_bytes(chunk)
... await stream.mark_complete()
... acc = b''
... async for chunk in stream_bytes(ipfs_hash, stream):
... acc += chunk
... print(acc)
...
>>> asyncio.run(test())
b'hello'
Metadata
Release files for ipfs-car-decoder 0.1.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 |
|---|---|---|---|---|
| ipfs_car_decoder-0.1.1.tar.gz | 11.4 kB | Without provenance | Details for ipfs_car_decoder-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ipfs_car_decoder-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ipfs_car_decoder-0.1.1-py3-none-any.whl |
Total release size: 17.8 kB
Release files / ipfs_car_decoder-0.1.1.tar.gz
| Download URL | ipfs_car_decoder-0.1.1.tar.gz |
|---|---|
| Size | 11.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1d7ae3fc519f5cdece38e229037fe1e5d6609ee8653d6baf538013c66010c41b
|
|
BLAKE2b-256 checksum How to use checksums |
e85e11eb9da00c2de2dac42f865ef8f513423c62fa7ed68a9801b1b6ed33adc9
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Release files / ipfs_car_decoder-0.1.1-py3-none-any.whl
| Download URL | ipfs_car_decoder-0.1.1-py3-none-any.whl |
|---|---|
| Size | 6.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
16482061a0edcc8fa6886f2a70537541a6814dfaa4470b4b6473009c90ecbf62
|
|
BLAKE2b-256 checksum How to use checksums |
53cead99a522e1a723a2880b2b5d64b2091e879ba15714e941541c167945656f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.2 CPython/3.10.12
|
Security for ipfs-car-decoder 0.1.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.