workbox-ipfs
TypeScript icon, indicating that this package has built-in type declarations

0.0.4 • Public • Published

Workbox IPFS

IPFS router for a Workbox service worker.

Table of content

How does it work

Once installed and initialized the IPFS router intercept and reply to IPFS urls and paths.

Valid requests are:

  • IPFS paths: /ipfs/Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu
  • IPNS paths: /ipns/github.com
  • IPFS urls: https://ipfs.io/ipfs/Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu
  • IPNS urls: https://ipfs.io/ipns/github.com

Installation

npm install --save workbox-ipfs

Usage

In the workbox service worker:

import { initialize } from 'workbox-ipfs';

initialize({
  /* IPFS Options */
})

On the web page:

const response = await fetch('/ipfs/Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu');
const file = await response.blob();

Install Dev Environment

npm install

npm run husky:install

Run Dev Application

npm run develop

Readme

Keywords

Package Sidebar

Install

npm i workbox-ipfs

Weekly Downloads

4

Version

0.0.4

License

MIT

Unpacked Size

1.83 MB

Total Files

6

Last publish

Collaborators

  • j4m3sb0mb