Struct ipfsapi::IpfsApi
[−]
[src]
pub struct IpfsApi { /* fields omitted */ }
Methods
impl IpfsApi
[src]
pub fn cat(&self, hash: &str) -> Result<impl Iterator<Item = u8>, Error>
[src]
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);
impl IpfsApi
[src]
pub fn name_resolve(&self, name: &str) -> Result<String, Error>
[src]
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);
pub fn name_publish(&self, hash: &str) -> Result<(), Error>
[src]
Publish an IPFS hash in IPNS.
impl IpfsApi
[src]
pub fn object_stats(&self, hash: &str) -> Result<ObjectStats, Error>
[src]
Get stats for an IPFS hash. It can be used to get the recursive size of a hash.
impl IpfsApi
[src]
pub fn pin_add(&self, hash: &str, recursive: bool) -> Result<PinResponse, Error>
[src]
Tells the IPFS server to pin the given object. If 'recursive' is true, it will recursively pin all objects that one depends on. If 'progress' is true, it will return a percentage(?) progress if the object has not been already pinned, or None if it has.
pub fn pin_rm(&self, hash: &str, recursive: bool) -> Result<PinResponse, Error>
[src]
Unpin the given object.
pub fn pin_list(&self) -> Result<Vec<PinnedHash>, Error>
[src]
List pinned objects.
impl IpfsApi
[src]
pub fn pubsub_subscribe(
&self,
channel: &str
) -> Result<impl Iterator<Item = PubSubMessage>, Error>
[src]
&self,
channel: &str
) -> Result<impl Iterator<Item = PubSubMessage>, Error>
Subscribes to a channel for p2p messages This function subscribes to a channel/topic and listens to any data sent to it. It can be used for peer-to-peer communication and dynamic apps over IPFS.
let api = IpfsApi::new("127.0.0.1", 5001); for message in api.pubsub_subscribe("chat")? { println!("{:?}", message); }
pub fn pubsub_publish(&self, channel: &str, data: &str) -> Result<(), Error>
[src]
Sends a p2p message to a channel This function sends a data packet to a channel/topic. It can be used for peer-to-peer communication and dynamic apps over IPFS.
impl IpfsApi
[src]
impl IpfsApi
[src]
pub fn shutdown(&self) -> Result<(), Error>
[src]
Shut down the IPFS daemon This function causes the IPFS daemon to terminate
impl IpfsApi
[src]
pub fn log_tail(&self) -> Result<impl Iterator<Item = Value>, Error>
[src]
Returns an iterator to the log stream. Since the log entries are flexible, a dynamic Serde value is returned.
impl IpfsApi
[src]
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.
pub fn new(server: &str, port: u16) -> IpfsApi
[src]
Creates a new instance of the API
let api = IpfsApi::new("127.0.0.1", 5001);