diff --git a/ipfshttpclient/client/__init__.py b/ipfshttpclient/client/__init__.py index 30e1afb..cbb63a2 100644 --- a/ipfshttpclient/client/__init__.py +++ b/ipfshttpclient/client/__init__.py @@ -259,8 +259,16 @@ def add_bytes(self, data: bytes, **kwargs): Hash of the added IPFS object """ body, headers = multipart.stream_bytes(data, chunk_size=self.chunk_size) - return self._client.request('/add', decoder='json', - data=body, headers=headers, **kwargs) + return self._client.request('/add', + decoder='json', data=body, headers=headers, **kwargs) + + @utils.return_field('Hash') + @base.returns_single_item(dict) + def add_raw_bytes(self, data: bytes, **kwargs): + # Same as add_bytes() but raw + body, headers = multipart.stream_bytes(data, chunk_size=self.chunk_size) + return self._client.request('/add?cid-version=1&chunker=size-1048576', + decoder='json', data=body, headers=headers, **kwargs) @utils.return_field('Hash') @base.returns_single_item(dict) @@ -328,4 +336,4 @@ def get_json(self, cid, **kwargs): object Deserialized IPFS JSON object value """ - return self.cat(cid, decoder='json', **kwargs) \ No newline at end of file + return self.cat(cid, decoder='json', **kwargs)