Skip to content

Latest commit

 

History

History
78 lines (55 loc) · 2.32 KB

README.md

File metadata and controls

78 lines (55 loc) · 2.32 KB

java-ipfs-api

standard-readme compliant

A Java implementation of the IPFS http api

Table of Contents

Install

Simply clone this repo.

Usage

Include the IPFS.jar in your project.

Create an IPFS instance with:

IPFS ipfs = new IPFS("/ip4/127.0.0.1/tcp/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);

Dependencies

Building


To build just run ant dist. The dependencies are included in the ./lib directory, and automatically copied to the ./dist/lib directory.

To run tests use ant test.

Contribute

Feel free to join in. All welcome. Open an issue!

This repository falls under the IPFS Code of Conduct.

License

MIT