Skip to content

tchardin/cache-blockstore

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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);
}());

About

An IPLD Blockstore on top of the browser CacheStore API

Resources

Stars

Watchers

Forks

Packages

No packages published