@dstanesc/http-block-store
TypeScript icon, indicating that this package has built-in type declarations

0.0.2 • Public • Published

Http Block Store

Readonly content-addressable storage (CAS) based on IPFS via custom HTTP gateways.

API

get: (cid: any) => Promise<Uint8Array>

Usage

// import
import { blockStore, resolvers } from '@dstanesc/http-block-store'

// optional cache
const cache = {}

// default resolver
const { get } = blockStore({ cache  })

// custom predefined resolver
const { ipfsIo: resolver } = resolvers()
const { get } = blockStore({ cache, resolver })

// plug custom resolver
const resolver = (cid: any) => `http://192.168.1.205:8080/ipfs/${cid.toString()}`
const { get } = blockStore({ cache, resolver })

Build

npm run clean
npm install
npm run build
npm run test

Test

Current test exec times

block get API
  ✓ zero config (922 ms)
  ✓ w3s.link explicit (825 ms)
  ✓ ipfs.io explicit (467 ms)
  ✓ plug custom resolver (78 ms)

Licenses

Licensed under either Apache 2.0 or MIT at your option.

Readme

Keywords

none

Package Sidebar

Install

npm i @dstanesc/http-block-store

Weekly Downloads

116

Version

0.0.2

License

(Apache-2.0 AND MIT)

Unpacked Size

29 kB

Total Files

28

Last publish

Collaborators

  • dstanesc