Skip to content

UlordChain/java-udfs-api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

java-udfs-api

A Java implementation of the UDFS http api

Table of Contents

Install

Official releases

You can use this project by including ipfs.jar from one of the releases.

Maven, Gradle, SBT

Package managers are supported through JitPack which supports Maven, Gradle, SBT, etc.

for Maven, add the following sections to your pom.xml (replacing $LATEST_VERSION):

	<repositories>
		<repository>
		    <id>jitpack.io</id>
		    <url>https://jitpack.io</url>
		</repository>
	</repositories>
	<dependency>
	    <groupId>com.github.UlordChain</groupId>
	    <artifactId>java-udfs-api</artifactId>
	    <version>v1.1</version>
	</dependency>

Usage

Create an UDFS instance with:

http: UDFS udfs = new UDFS("127.0.0.1",5001,false);
https: UDFS udfs = new UDFS("127.0.0.1",5001,true);

Then run commands like:

udfs.refs.local();

To add a file and bakeup other masternode use (the push method returns a list of merklenodes, in this case there is only one element):

NamedStreamable.FileWrapper file = new NamedStreamable.FileWrapper(new File("udfs.txt"));
MerkleNode addResult = udfs.push(file).get(0);

To push a byte[] use:

NamedStreamable.ByteArrayWrapper file = new NamedStreamable.ByteArrayWrapper("udfs.txt", "hello world".getBytes());
MerkleNode addResult = udfs.push(file).get(0);

To get a file use:

Multihash filePointer = Multihash.fromBase58("hash值");
byte[] fileContents = udfs.cat(filePointer);

Dependencies

Current versions of dependencies are included in the ./lib directory.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages