mirror of
https://github.com/openwrt/packages.git
synced 2025-12-23 08:04:32 +04:00
ipfs-http-client: initial commit
IPFS C++ HTTP API client library allows C++ applications to communicate with an IPFS node. It implements IPFS API bindings for C++. Not all methods are implemented. https://github.com/vasild/cpp-ipfs-http-client Signed-off-by: Leonid Esman <leonid.esman@gmail.com>
This commit is contained in:
23
libs/ipfs-http-client/src/test/demo.cpp
Normal file
23
libs/ipfs-http-client/src/test/demo.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
// g++ -std=c++11 -I./include test1.cpp libipfs-http-client.a -lcurl -o ipfs-test
|
||||
// g++ -std=c++11 -I./include test1.cpp -lipfs-http-client -lcurl -o ipfs-test
|
||||
// g++ -std=c++11 -I./include -L. -Wl,-rpath,. test1.cpp -lipfs-http-client -lcurl -o ipfs-test
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <ipfs/client.h>
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
std::stringstream contents;
|
||||
char addr127001[]="127.0.0.1";
|
||||
char *addr;
|
||||
if (argc<2)
|
||||
addr=addr127001;
|
||||
else
|
||||
addr=argv[1];
|
||||
ipfs::Client client(addr, 5001);
|
||||
client.FilesGet("/ipfs/QmYwAPJzv5CZsnA625s3Xf2nemtYgPpHdWEz79ojWnPbdG/readme", &contents);
|
||||
std::cout << contents.str() << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user