cache-blockstore
v0.1.0
Published
An IPLD Blockstore on top of the browser CacheStorage API
Downloads
2
Readme
Cache Blockstore
An IPLD Blockstore on top of the browser CacheStorage API
Install
npm i cache-blockstore
Usage
import {Cachestore} from "cache-blockstore";
import * as Block from 'multiformats/block'
import * as codec from '@ipld/dag-cbor'
import { sha256 as hasher } from 'multiformats/hashes/sha2'
const value = { hello: 'world' }
(async () => {
const store = new Cachestore("/my-app/blocks");
await store.open();
// encode a block
let block = await Block.encode({ value, codec, hasher })
await store.put(block.cid, block.bytes);
}());