@@ -54,6 +54,82 @@ test.all(common)
54
54
55
55
A valid (read: that follows this interface) IPFS core implementation, must expose the following API.
56
56
57
+ ## Block
58
+
59
+ ### ` block.put `
60
+
61
+ > Create a new IPFS Block.
62
+
63
+ ##### ` Go ` ** WIP**
64
+
65
+ ##### ` JavaScript ` - ipfs.block.put(data, [ callback] )
66
+
67
+ Where ` data ` can be a
68
+
69
+ - Buffer, requiring that the encoding is specified on the options. If no
70
+ encoding is specified, Buffer is treated as the Data field
71
+ - [ Block] [ ] instance
72
+
73
+ ` callback ` has the signature ` function (err, block) {} ` , where ` err ` is an error
74
+ if the operation was not successful. and ` block ` is a [ Block] [ ] .
75
+
76
+
77
+
78
+
79
+ ### ` block.get `
80
+
81
+ > Retrieve an IPFS Block from the underlying Block Store by its mulithash.
82
+
83
+ ##### ` Go ` ** WIP**
84
+
85
+ ##### ` JavaScript ` - ipfs.block.get(multihash, [ callback] )
86
+
87
+ ` multihash ` is a [ multihash] [ ] which can be passed as a
88
+
89
+ - Buffer, the raw Buffer of the multihash (or of and encoded version)
90
+ - String, the toString version of the multihash (or of an encoded version)
91
+
92
+ ` callback ` must follow the signature ` function (err, node) {} ` , where ` err ` is
93
+ an error if the operation was not successful and ` block ` is a [ Block] [ ] .
94
+
95
+ If no ` callback ` is passed, a promise is returned.
96
+
97
+
98
+
99
+
100
+ ### ` block.stat `
101
+
102
+ > Returns various stats of an IPFS Block
103
+
104
+ ##### ` Go ` ** WIP**
105
+
106
+ ##### ` JavaScript ` - ipfs.block.stat(multihash, [ options, callback] )
107
+
108
+ ` multihash ` is a [ multihash] [ ] which can be passed as:
109
+
110
+ - Buffer, the raw Buffer of the multihash (or of and encoded version)
111
+ - String, the toString version of the multihash (or of an encoded version)
112
+
113
+ ` callback ` must follow the signature ` function (err, stats) {} ` , where ` err ` is
114
+ an error if the operation was not successful and ` stats ` is an object with
115
+ the format
116
+
117
+ ``` JavaScript
118
+ {
119
+ Hash: ' QmPTkMuuL6PD8L2SwTwbcs1NPg14U8mRzerB1ZrrBrkSDD' ,
120
+ NumLinks: 0 ,
121
+ BlockSize: 10 ,
122
+ LinksSize: 2 ,
123
+ DataSize: 8 ,
124
+ CumulativeSize: 10
125
+ }
126
+ ```
127
+
128
+ If no ` callback ` is passed, a promise is returned.
129
+
130
+
131
+
132
+
57
133
## Object
58
134
59
135
### ` object.new `
@@ -119,10 +195,6 @@ If no `callback` is passed, a promise is returned.
119
195
120
196
If no ` callback ` is passed, a promise is returned.
121
197
122
- ### ` object.data `
123
-
124
- > Returns the Data field of an object
125
-
126
198
##### ` Go ` ** WIP**
127
199
128
200
##### ` JavaScript ` - ipfs.object.data(multihash, [ options, callback] )
@@ -309,5 +381,6 @@ If no `callback` is passed, a promise is returned.
309
381
If no ` callback ` is passed, a promise is returned.
310
382
311
383
384
+ [ Block ] : https://github.com/ipfs/js-ipfs-block
312
385
[ DAGNode ] : https://github.com/vijayee/js-ipfs-merkle-dag
313
386
[ multihash ] : http://github.com/jbenet/multihash
0 commit comments