# libmisc-ipfs-http-c
* 这是一个建立在[IPFS(星际文件系统)](https://github.com/ipfs) HTTP API上的c++ client library. 已实现的功能包括:
* files.ls
* files.read
* files.rm
* files.stat
* files.write
* add
* get
* 一个适用于http-get的通用接口.
* demo:
```cpp
#include <libmisc-ipfs-http-c.h>
int main(int argc, char **argv)
{
Log::setTrace();
shared_ptr<IpfsHttpClient> ipfs(new IpfsHttpClient("http://127.0.0.1:5001/api/v0/"));
int err;
string desc;
//
ipfs->filesWrite("/home/dev5/ipfs-hello-world0.txt", "/ipfs-hello-world0.txt", err, desc); /* ipfs files write. */
ipfs->filesWrite("/home/dev5/ipfs-hello-world1.txt", "/ipfs-hello-world1.txt", err, desc);
shared_ptr<list<shared_ptr<IpfsFileLsRspEntry>>> lis = ipfs->filesLs("/", err, desc);
for (auto& it : *lis)
{
LOG_DEBUG("%s", it->toString().c_str())
}
LOG_DEBUG("content: %s", ipfs->filesRead("/ipfs-hello-world0.txt", err, desc).c_str()) /* ipfs files read. */
ipfs->filesRm("/ipfs-hello-world0.txt", err, desc); /* ipfs files rm */
LOG_DEBUG("stat: %s", ipfs->filesStat("/ipfs-hello-world1.txt", err, desc)->toString().c_str()) /* ipfs files stat. */
shared_ptr<IpfsAddRsp> add = ipfs->add("/home/dev5/ipfs-hello-world0.txt", err, desc);
LOG_DEBUG("add: %s", add->toString().c_str()) /* ipfs add. */
LOG_DEBUG("get: %s", ipfs->get(add->hash, err, desc).c_str()) /* ipfs get. */
//
LOG_DEBUG("%s", ipfs->httpGet("swarm/peers", err, desc).c_str()) /* ipfs xxx. */
return EXIT_SUCCESS;
}
```
* 依赖
* [libmisc](https://github.com/dev5cn/libmisc-cpp)
* [libcurl](https://github.com/curl/curl)
* [libarchive](https://github.com/libarchive/libarchive)
* 编译
```js
export PLAT=LINUX
export LIB_CURL=/home/dev5/tools/curl-7.66.0
export LIB_ARCHIVE=/home/dev5/tools/libarchive-3.4.0
export CC=/usr/bin/gcc
export CXX=/usr/bin/g++
export CXX_FLAG="-g3 -O3"
export MAKE_J="-j3"
```
```js
ls ./
libmisc-cpp libmisc-ipfs-http-c
chmod 775 */*.sh
cd libmisc-ipfs-http-c;./build.sh
```
没有合适的资源?快使用搜索试试~ 我知道了~
建立在IPFS(星际文件系统) HTTP API上的c++ client library.rar
共21个文件
h:7个
cpp:6个
txt:3个
需积分: 5 0 下载量 187 浏览量
2023-05-31
19:12:05
上传
评论
收藏 139KB RAR 举报
温馨提示
.什么是IPFS IPFS(InterPlanetary File System,缩写IPFS)中文译为星际文件系统,是一个旨在创建持久且分布式存储和共享文件的网络传输协议。它是一种内容可寻址的对等超媒体分发协议。是一个底层的互联网协议,致力于替代 HTTP协议,实现的是互联网上各个节点的文件读取、分享、交换。在IPFS网络中的节点将构成一个分布式文件系统。而 HTTP 协议依赖于 Internet 主网。IPFS 是点对点的超媒体协议,可以让网络更快、更安全、更开放。 它是一个面向全球的、点对点的分布式版本文件系统,试图将所有具有相同文件系统的计算设备连接在一起。 什么叫内容寻址?传统的http协议请求,是根据中心化服务提供的一个明确的地址,客户端访问其地址就可以获取到信息,而IPFS的内容寻址,则是根据文件内容去寻找可访问的地址,它不依赖与中心服务器,如果在IPFS网络里, 有邻近你个人的IPFS网络的内容,则优先就近读取,提高访问效率
资源推荐
资源详情
资源评论
收起资源包目录
建立在IPFS(星际文件系统) HTTP API上的c++ client library.rar (21个子文件)
建立在IPFS(星际文件系统) HTTP API上的c++ client library
新建文本文档.txt 19B
libmisc-ipfs-http-c-master
CurlOper.h 1KB
CMakeLists.txt 494B
IpfsFileStatRsp.h 1001B
IpfsFiles.h 2KB
json.hpp 791KB
clean.sh 73B
IpfsAddRsp.h 936B
LICENSE.txt 34KB
IpfsFileStatRsp.cpp 1KB
CurlOper.cpp 5KB
IpfsHttpClient.cpp 5KB
IpfsAddRsp.cpp 966B
libmisc-ipfs-http-c.h 821B
IpfsFiles.cpp 6KB
IpfsFileLsRspEntry.cpp 1KB
IpfsFileLsRspEntry.h 990B
IpfsHttpClient.h 2KB
README.md 2KB
build.sh 65B
__file__.cmake 535B
共 21 条
- 1
资源评论
野生的狒狒
- 粉丝: 1498
- 资源: 1530
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功