File tree Expand file tree Collapse file tree 1 file changed +37
-1
lines changed
Expand file tree Collapse file tree 1 file changed +37
-1
lines changed Original file line number Diff line number Diff line change 11# IPFS-API-Java
2- A Java implementation of the HTTP IPFS API
2+ A Java implementation of the IPFS http api
33
4+ ##Usage
5+ -----
6+ Include the IPFS.jar in your project.
7+
8+ Create an IPFS instance with:
9+ ``` Java
10+ IPFS ipfs = new IPFS (" 127.0.0.1" , 5001 );
11+ ```
12+
13+ Then run commands like:
14+ ``` Java
15+ ipfs. refs. local();
16+ ```
17+
18+ To add a file use:
19+ ``` Java
20+ NamedStreamable . FileWrapper file = new NamedStreamable .FileWrapper (new File (" hello.txt" ));
21+ MerkleNode addResult = ipfs. add(file);
22+ ```
23+
24+ To add a byte[ ] use:
25+ ``` Java
26+ NamedStreamable . ByteArrayWrapper file = new NamedStreamable .ByteArrayWrapper (" hello.txt" , " G'day world! IPFS rocks!" . getBytes());
27+ MerkleNode addResult = ipfs. add(file);
28+ ```
29+
30+ To get a file use:
31+ ``` Java
32+ MerkleNode addResult = new MerkleNode (" QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB" );
33+ byte [] fileContents = ipfs. cat(merkleObject);
34+ ```
35+
36+ ##Building
37+ ---------
438To build just run make. There are no dependencies, just include the resulting IPFS.jar in your project.
39+
40+ To run tests use make tests.
You can’t perform that action at this time.
0 commit comments