Skip to content

Commit dd63f48

Browse files
committed
block.stat
1 parent 6293cd4 commit dd63f48

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

src/org/ipfs/IPFS.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,9 @@ public List<MerkleNode> put(List<byte[]> data) throws IOException {
127127
return JSONParser.parseStream(res).stream().map(x -> MerkleNode.fromJSON((Map<String, Object>) x)).collect(Collectors.toList());
128128
}
129129

130-
//TODO stat
130+
public Map<String, Object> stat(MerkleNode merkleObject) throws IOException {
131+
return (Map)retrieveAndParse("block/stat?stream-channels=true&arg=" + merkleObject.hash);
132+
}
131133
}
132134

133135
/* 'ipfs object' is a plumbing command used to manipulate DAG objects directly. {Object} is a subset of {Block}

test/org/ipfs/Test.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public void objectTest() {
7676
public void blockTest() {
7777
try {
7878
MerkleNode pointer = new MerkleNode("QmPZ9gcCEpqKTo6aq61g2nXGUhM4iCL3ewB6LDXZCtioEB");
79+
Map stat = ipfs.block.stat(pointer);
7980
byte[] object = ipfs.block.get(pointer);
8081
List<MerkleNode> newPointer = ipfs.block.put(Arrays.asList("Some random data...".getBytes()));
8182
} catch (IOException e) {

0 commit comments

Comments
 (0)