Skip to content

Commit f85eb8a

Browse files
committed
clean up tests and add hashOnly option to add.
1 parent e13133d commit f85eb8a

File tree

2 files changed

+407
-503
lines changed

2 files changed

+407
-503
lines changed

src/main/java/io/ipfs/api/IPFS.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,11 +71,15 @@ public List<MerkleNode> add(NamedStreamable file) throws IOException {
7171
}
7272

7373
public List<MerkleNode> add(NamedStreamable file, boolean wrap) throws IOException {
74-
return add(Collections.singletonList(file), wrap);
74+
return add(file, wrap, false);
7575
}
7676

77-
public List<MerkleNode> add(List<NamedStreamable> files, boolean wrap) throws IOException {
78-
Multipart m = new Multipart("http://" + host + ":" + port + version + "add?w="+wrap, "UTF-8");
77+
public List<MerkleNode> add(NamedStreamable file, boolean wrap, boolean hashOnly) throws IOException {
78+
return add(Collections.singletonList(file), wrap, hashOnly);
79+
}
80+
81+
public List<MerkleNode> add(List<NamedStreamable> files, boolean wrap, boolean hashOnly) throws IOException {
82+
Multipart m = new Multipart("http://" + host + ":" + port + version + "add?w="+wrap + "&n="+hashOnly, "UTF-8");
7983
for (NamedStreamable file: files) {
8084
if (file.isDirectory()) {
8185
m.addSubtree(Paths.get(""), file);

0 commit comments

Comments
 (0)