JSPM

cache-blockstore

0.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 1
  • Score
    100M100P100Q10824F
  • License MIT

An IPLD Blockstore on top of the browser CacheStorage API

Package Exports

  • cache-blockstore
  • cache-blockstore/dist/src/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (cache-blockstore) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

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