• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

bbmoron/rust-ipfs-api: Rust language IPFS API implementation

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称:

bbmoron/rust-ipfs-api

开源软件地址:

https://github.com/bbmoron/rust-ipfs-api

开源编程语言:

Rust 100.0%

开源软件介绍:

rust-ipfs-api

A Rust client library for the IPFS HTTP API

Rust inspires thousands people to create and develop many services

Assuming this, IPFS is one of the most popular technologies to use to, but there is no easy way to use IPFS API in projects on rust. People have to run Go programs, or create cURL/reqwest/hyper wrappers in order to use IPFS cURL API. Having this repo as a dependency it is mush easier to start developing your apps on top of IPFS!


Let's say, you want to store files in IPFS and read them right from the net:
mod coder;
mod ipfs-api;

use ipfs-api::IPFS;
use coder::Coder;

fn main() {
    let mut ipfs = IPFS::new();
    ipfs.host("http://localhost", 5001);

    let ipfs_response = ipfs.add("./it_works.txt");
    let parsed_response = Coder::to_json2(&ipfs_response);
    let hashsumm = &parsed_response["Hash"].to_string();
    assert_eq!("QmaGXbCcuNazWyCmdiHsN9bdZ1GEx1GArUvbmyzkHmotDH", &hashsumm); // TRUE

    let ipfs_response = ipfs.cat(hashsumm);
    let parsed_response = Coder::decode_to_str(ipfs_response);
    assert_eq!("hello, it really works!\n", parsed_response); // TRUE
}

Easy, huh? That's the most common way to use API :) Try it out and don't forget to help the project!




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap