Skip to content
This repository was archived by the owner on Apr 3, 2025. It is now read-only.

Commit 476e4fb

Browse files
committed
feat: js-ipfs works inside a service worker!
1 parent 9f98384 commit 476e4fb

File tree

13 files changed

+102
-155737
lines changed

13 files changed

+102
-155737
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,4 @@ jspm_packages
3535

3636
# Optional REPL history
3737
.node_repl_history
38+
examples/use-from-another-page/public+sw/service-worker-bundle.js

README.md

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,22 @@
1-
# ipfs-service-worker
2-
Run an IPFS node inside a service worker and serve all your IPFS Urls directly from IPFS!
1+
# Use `js-ipfs` within a service worker
2+
3+
[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
4+
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
5+
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
6+
[![standard-readme compliant](https://img.shields.io/badge/standard--readme-OK-green.svg?style=flat-square)](https://github.com/RichardLitt/standard-readme)
7+
[![Build Status](https://travis-ci.org/ipfs/ipfs-service-worker.svg?style=flat-square)](https://travis-ci.org/ipfs/ipfs-service-worker)
8+
[![Coverage Status](https://coveralls.io/repos/github/ipfs/ipfs-service-worker/badge.svg?branch=master)](https://coveralls.io/github/ipfs/ipfs-service-worker?branch=master)
9+
[![Dependency Status](https://david-dm.org/ipfs/ipfs-service-worker.svg?style=flat-square)](https://david-dm.org/ipfs/ipfs-service-worker)
10+
[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat-square)](https://github.com/feross/standard)
11+
![](https://img.shields.io/badge/npm-%3E%3D3.0.0-orange.svg?style=flat-square)
12+
![](https://img.shields.io/badge/Node.js-%3E%3D4.0.0-orange.svg?style=flat-square)
13+
14+
> Run an IPFS node inside a service worker and serve all your IPFS Urls directly from IPFS!
15+
16+
# BEWARE BEWARE there may be dragons! 🐉
17+
18+
This module is still experimental because it is indeed an experiment part of the https://github.com/ipfs/in-web-browsers endeavour.
19+
20+
# Usage
21+
22+
This module requires `js-ipfs v0.24.0 or higher`

examples/use-from-another-page/public-with-sw/index.html renamed to examples/use-from-another-page/public+sw/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
</head>
33
<body>
44
<h1>js-ipfs in a service worker</h1>
5-
<textarea id="input"></textarea>
5+
<textarea id="input" cols="100"></textarea>
66
<button id="show">Fetch</button>
77
<div id="display"></div>
88
<script src="index.js"></script>

examples/use-from-another-page/public-with-sw/index.js renamed to examples/use-from-another-page/public+sw/index.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ if ('serviceWorker' in navigator) {
1313
document.querySelector('#show').addEventListener('click', () => {
1414
const multihash = document.querySelector('#input').value
1515
let imgElement = document.createElement('img')
16+
17+
// imgElement.src = multihash
1618
imgElement.src = '/ipfs/' + multihash
1719
// imgElement.src = 'https://ipfs.io/ipfs/' + multihash
1820
document.querySelector('#display').appendChild(imgElement)

0 commit comments

Comments
 (0)