pub struct IpfsApi { /* private fields */ }

Implementations

Retrieves the contents of a file from the IPFS network. Takes a hash and returns an iterator of bytes. The result can be streamed, if the file is large.

let api = IpfsApi::new("127.0.0.1", 5001);

let hello = api.cat("QmWATWQ7fVPP2EFGu71UkfnqhYXDYH566qy47CnJDgvs8u")?;
let hello_string = String::from_utf8(hello.collect())?;
println!("{}", hello_string);

Shut down the IPFS daemon This function causes the IPFS daemon to terminate

Get the version from the IPFS daemon.

Get a raw IPFS block.

Notes

This is a wrapper for the /api/v0/block/get API.

Errors

This function can return an error if the IPFS node is down, or if the block cannot be retrieved.

Examples
let api = IpfsApi::new("127.0.0.1", 5001);

let hash = "QmV8cfu6n4NT5xRr2AHdKxFMTZEJrA44qgrBCr739BN9Wb";
let block = api.block_get(hash).unwrap();
let string = String::from_utf8(block.collect()).unwrap();

assert_eq!(string, "Hello world");

Puts a raw block into IPFS.

Notes

This is a wrapper for the /api/v0/block/put API.

Publish an IPFS hash in IPNS.

Resolve an IPNS hash or a domain name

let api = IpfsApi::new("127.0.0.1", 5001);
let hash = api.name_resolve("gkbrk.com")?;

println!("{}", hash);

Publish an IPFS hash in IPNS.

The main interface of the library The IpfsApi class represents a connection to the local IPFS daemon. It can read and write data to it using http requests to the server.

Creates a new instance of the API

let api = IpfsApi::new("127.0.0.1", 5001);

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.