I want to directly upload content of a file to IPFS without writes the file then upload to the ipfs . I use python. Can you help me ?
‘without writes the file’
You have to write a file … then you can add/upload to IPFS
1 Like
I assume you’re using https://github.com/ipfs/py-ipfs-http-client? I believe you need to call add_bytes
or add_str`.
1 Like
Right, I stand corrected. Thanks, stebalien!
add_bytes
( data , **kwargs)
Adds a set of bytes as a file to IPFS.
client.add_bytes(b"Mary had a little lamb")
‘QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab’
add_str() almost the exact same call:
client.add_str(u"Mary had a little lamb")
‘QmZfF6C9j4VtoCsTp4KSrhYH47QMd3DNXVZBKaxJdhaPab’
1 Like