Code Monkey home page Code Monkey logo

rust-ipfs-api's Introduction

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

rust-ipfs-api's People

Contributors

gkbrk avatar icefoxen avatar jackdoe avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.