@@ -17,8 +17,7 @@ IPFS Block Service JavaScript Implementation
1717
1818** BlockService** - A BlockService is a content-addressable store for blocks,
1919providing an API for adding, deleting, and retrieving blocks. A BlockService is
20- backed by an [ IPFS Repo] [ repo ] as its datastore for blocks, and uses an [ IPFS
21- Exchange] [ bitswap ] implementation to fetch blocks from the network.
20+ backed by an [ IPFS Repo] [ repo ] as its datastore for blocks, and uses [ Bitswap] [ bitswap ] to fetch blocks from the network.
2221
2322``` markdown
2423┌────────────────────┐
@@ -27,9 +26,9 @@ Exchange][bitswap] implementation to fetch blocks from the network.
2726 │
2827 ┌─────┴─────┐
2928 ▼ ▼
30- ┌─────────┐ ┌──────── ┐
31- │IPFS Repo│ │Exchange │
32- └─────────┘ └──────── ┘
29+ ┌─────────┐ ┌───────┐
30+ │IPFS Repo│ |Bitswap │
31+ └─────────┘ └───────┘
3332```
3433
3534## Example
@@ -99,7 +98,7 @@ var BlockService = require('ipfs-block-service')
9998
10099### Browser: ` <script> ` Tag
101100
102- Loading this module through a script tag will make the ` Unixfs ` obj available in
101+ Loading this module through a script tag will make the ` IpfsBlockService ` obj available in
103102the global namespace.
104103
105104``` html
@@ -108,71 +107,11 @@ the global namespace.
108107<script src =" https://npmcdn.com/ipfs-block-service/dist/index.js" ></script >
109108```
110109
111- ## API
112-
113- ``` js
114- const BlockService = require (' ipfs-block-service' )
115- ```
116-
117- ### var bs = new BlockService(repo[ , exchange] )
118-
119- Creates a new block service backed by [ IPFS Repo] [ repo ] ` repo ` for storage, and
120- [ IPFS Exchange] [ bitswap ] for retrieving blocks from the network. Providing an
121- ` exchange ` is optional.
122-
123- #### bs.addBlock(block, callback(err))
124-
125- Asynchronously adds a block instance to the underlying repo.
126-
127- #### bs.addBlocks(blocks, callback(err))
128-
129- Asynchronously adds an array of block instances to the underlying repo.
130-
131- * Does not guarantee atomicity.*
132-
133- #### bs.getBlock(multihash, callback(err, block))
134-
135- Asynchronously returns the block whose content multihash matches ` multihash ` .
136- Returns an error (` err.code === 'ENOENT' ` ) if the block does not exist.
137-
138- If the block could not be found, expect ` err.code ` to be ` 'ENOENT' ` .
139-
140- #### bs.getBlocks(multihashes, callback(err, blocks))
141-
142- Asynchronously returns the blocks whose content multihashes match the array
143- ` multihashes ` .
144-
145- ` blocks ` is an object that maps each ` multihash ` to an object of the form
146-
147- ``` js
148- {
149- err: Error
150- block: Block
151- }
152- ```
153-
154- Expect ` blocks[multihash].err.code === 'ENOENT' ` and `blocks[ multihash] .block
155- === null` if a block did not exist.
156-
157- * Does not guarantee atomicity.*
158-
159- #### bs.deleteBlock(multihash, callback(err))
160-
161- Asynchronously deletes the block from the store with content multihash matching
162- ` multihash ` , if it exists.
163-
164- #### bs.deleteBlocks(multihashes, callback(err))
165-
166- Asynchronously deletes all blocks from the store with content multihashes matching
167- from the array ` multihashes ` .
168-
169- * Does not guarantee atomicity.*
110+ You can find the [ API documentation here] ( API.md )
170111
171112## License
172113
173114MIT
174115
175116[ ipfs ] : https://ipfs.io
176- [ repo ] : https://github.com/ipfs/specs/tree/master/repo
177117[ bitswap ] : https://github.com/ipfs/specs/tree/master/bitswap
178- [ multihash ] : https://github.com/jbenet/js-multihash
0 commit comments