Create a new BlockStorage
Private
Readonly
childPrivate
Readonly
pinsPrivate
startedOptional
options: AbortOptionsDelete a block from the blockstore
Delete multiple blocks from the blockstore
Get a block by cid
Retrieve all cid/block pairs from the blockstore as an unordered iterable
for await (const { multihash, block } of store.getAll()) {
console.log('got:', multihash, block)
// => got MultihashDigest('Qmfoo') Uint8Array[...]
}
Get multiple blocks back from an (async) iterable of cids
Check for the existence of a value for the passed key
const exists = await store.has(new Key('awesome'))
if (exists) {
console.log('it is there')
} else {
console.log('it is not there')
}
Put a block to the underlying datastore
Put a multiple blocks to the underlying datastore
BlockStorage is a hybrid blockstore that puts/gets blocks from a configured blockstore (that may be on disk, s3, or something else). If the blocks are not present Bitswap will be used to fetch them from network peers.