Skip to content

ipfs-shipyard/java-ipfs-http-client

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

48 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

IPFS-API-Java

A Java implementation of the IPFS http api

##Usage

Include the IPFS.jar in your project.

Create an IPFS instance with:

IPFS ipfs = new IPFS("127.0.0.1", 5001);

Then run commands like:

ipfs.refs.local();

To add a file use:

NamedStreamable.FileWrapper file = new NamedStreamable.FileWrapper(new File("hello.txt")); MerkleNode addResult = ipfs.add(file);

To add a byte[] use:

NamedStreamable.ByteArrayWrapper file = new NamedStreamable.ByteArrayWrapper("hello.txt", "G'day world! IPFS rocks!".getBytes()); MerkleNode addResult = ipfs.add(file);

To get a file use:

Multihash filePointer = Multihash.fromBase58("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB"); byte[] fileContents = ipfs.cat(filePointer);

##Building

To build just run make. There are no dependencies, just include the resulting IPFS.jar in your project.

To run tests use make tests.

About

A Java implementation of the HTTP IPFS API

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 21

Languages