| Crates.io | semtexzv-ipfsapi |
| lib.rs | semtexzv-ipfsapi |
| version | 0.4.1-alpha.2 |
| created_at | 2020-07-24 20:43:25.885817+00 |
| updated_at | 2020-07-26 09:34:30.313788+00 |
| description | Crate for interfacing with the IPFS api |
| homepage | |
| repository | https://github.com/semtexzv/rust-ipfs-api |
| max_upload_size | |
| id | 269318 |
| size | 45,549 |
A client library for the IPFS API.
This library allows you to use the local IPFS daemon from Rust.
[dependencies]
ipfsapi = "0.2"
Here's an example that gets the contents of a file from IPFS and displays it.
let api = IpfsApi::new("127.0.0.1", 5001);
let bytes = api.cat("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u").unwrap();
let data = String::from_utf8(bytes.collect()).unwrap();
println!("{}", data);
The code gets the content of the IPFS hash and displays "Hello World".
let api = IpfsApi::new("127.0.0.1", 5001);
let messages = api.pubsub_subscribe("chat").unwrap();
for message in messages {
println!("{:?}", message);
}