12 releases

Uses old Rust 2015

0.3.0 Aug 4, 2019
0.2.2 May 11, 2018
0.2.1 Mar 12, 2018
0.1.7 Dec 4, 2017
0.1.5 Oct 18, 2017

#15 in #ipfs

Download history 40/week @ 2021-08-05 18/week @ 2021-08-12 9/week @ 2021-08-19 5/week @ 2021-08-26 12/week @ 2021-09-09 9/week @ 2021-09-16 13/week @ 2021-09-30 5/week @ 2021-10-07 20/week @ 2021-10-14 7/week @ 2021-10-21 4/week @ 2021-10-28 29/week @ 2021-11-04 21/week @ 2021-11-18

55 downloads per month

MIT license

17KB
375 lines

Rust IPFS API Client

Crates.io Docs.rs

A client library for the IPFS API.

This library allows you to use the local IPFS daemon from Rust.

Usage

[dependencies]
ipfsapi = "0.2"

Examples

Reading a file from IPFS

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".

Subsribing to messages on IPFS Pubsub

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

let messages = api.pubsub_subscribe("chat").unwrap();

for message in messages {
    println!("{:?}", message);
}

Implemented Functionality

  • Getting file contents from IPFS (cat)
  • Pubsub
  • IPNS publish and resolve
  • Object/Hash stats (size, etc.)
  • Version information of the daemon
  • Pinning and unpinning files
  • Shut down IPFS daemon
  • Get and put blocks

Dependencies

~17MB
~399K SLoC