-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How can I add/retrieve a raw buffer to IPFS? #6
Comments
When you say add a raw buffer, do you mean adding it as a file or creating a block? |
I don't know what the best option would be. I just want to upload and retrieve raw data from a decentralized store. Suggestion? |
I added an API to add and retrieve blocks to the new version. Let me know if there are any problems with it. TODO: Write docs for the block api |
Wow, well, thank you very much. Sadly, I didn't manage to use it. Am I doing something wrong? I've started IPFS with let api = IpfsApi::new("127.0.0.1", 5001);
let hash = api.block_put("Hello world".as_bytes()).unwrap();
assert_eq!(hash, "QmV8cfu6n4NT5xRr2AHdKxFMTZEJrA44qgrBCr739BN9Wb"); Results in the following error:
If I replace the URL by "gateway.ipfs.io", I instead get:
Changing it to "ipfs.io" or "gateway.ipfs.io" results in "Connection error". The other test also doesn't work for similar reasons. Chances are this is some misunderstanding of my part about how IPFS works, but I'm not sure what it is, given that I'm used the same code on your tests, so it should work. Perhaps I'm opening IPFS wrongly, and also using the gateways incorrectly? |
As you mentioned, that code is part of the tests. When I run the code on my machine, it passes successfully. You can try to run IPFS from the command line with the gateway.ipfs.io does not let you create blocks. It only allows you to download them. To connect to the public gateway, try connecting with IpfsApi::new("gateway.ipfs.io", 80); |
Just wondering if that usage is implemented. Thanks :)
The text was updated successfully, but these errors were encountered: