-
Notifications
You must be signed in to change notification settings - Fork 41
Description
ipwb currently cannot add data as raw blocks. Benefits of raw blocks: they are faster and use up less storage space.
Whenever ipwb adds something to ipfs it uses this python api: https://github.com/ipfs-shipyard/py-ipfs-http-client (ipfshttpclient). Documentation:
https://ipfs.ssi.eecc.de/ipfs/QmSfSEXrkYzsLz4adKJzVe9zj8dT8V6X9rkXdXCenV35pQ/docs/http_client_ref.html
Looking at this section:
https://ipfs.ssi.eecc.de/ipfs/QmSfSEXrkYzsLz4adKJzVe9zj8dT8V6X9rkXdXCenV35pQ/docs/http_client_ref.html#ipfshttpclient.Client.add_bytes
it says nothing about add_bytes() having an option to add raw blocks. Therefore, perhaps use a different thing which can add raw blocks, or modify the source code of that Python API to be able to do that. ipfshttpclient/client/__init__.py defines the add_bytes method/function. As I understand, ipfshttpclient is a wrapper or implementation that communicates with Kubo IPFS's core API. For example, that __init__.py file says
def add_bytes(self, data: bytes, **kwargs):
"""Adds a set of bytes as a file to IPFS.
[...]
"""
body, headers = multipart.stream_bytes(data, chunk_size=self.chunk_size)
return self._client.request('/add', decoder='json',
data=body, headers=headers, **kwargs)
@utils.return_field('Hash')
@base.returns_single_item(dict)
which looks like an API call. Raw blocks normally look like this: https://gateway.pinata.cloud/ipfs/bafkreibr3eo4ryibk6yueswcgepfybw33nwngs4z4vmr4ck2ky43j7cn64 (starts with "bafk"). Kubo ipfs command to create it: "ipfs add --cid-version=1 setup.cfg".