Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shop3/workbox-ipfs
IPFS router for a Workbox service worker.
https://github.com/shop3/workbox-ipfs
ipfs workbox
Last synced: 10 days ago
JSON representation
IPFS router for a Workbox service worker.
- Host: GitHub
- URL: https://github.com/shop3/workbox-ipfs
- Owner: shop3
- License: mit
- Created: 2022-07-21T13:28:54.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-03-03T01:27:57.000Z (almost 2 years ago)
- Last Synced: 2024-11-15T22:09:23.778Z (about 1 month ago)
- Topics: ipfs, workbox
- Language: JavaScript
- Homepage:
- Size: 4.01 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 5
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# Workbox IPFS
IPFS router for a Workbox service worker.
## Table of content
- [How does it work](#how-does-it-work)
- [Installation](#installation)
- [Usage](#usage)
- [Install Dev Environment](#install-dev-environment)
- [Run Dev Application](#run-dev-application)## 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
```bash
npm install --save workbox-ipfs
```## Usage
In the workbox service worker:
```js
import { initialize } from 'workbox-ipfs';initialize({
/* IPFS Options */
})
```On the web page:
```js
const response = await fetch('/ipfs/Qme7ss3ARVgxv6rXqVPiikMJ8u2NLgmgszg13pYrDKEoiu');
const file = await response.blob();
```## Install Dev Environment
```bash
npm installnpm run husky:install
```## Run Dev Application
```bash
npm run develop
```