1.5.0 • Published 2 years ago

serviceworker-server v1.5.0

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

ServiceWorker Server

This project makes it easier to serve files from within the page as a regular url request.

Let's say you have a website with a service worker. In your site you've made a file that exists in

that you would like the user to download.

You can stream the file contents through your serviceworker, giving the resource a friendly URL to your site. There is a library already that handles serving files out of a downloaded torrent through a webtorrent client on the page.

// serviceworker.js
import { swserve } from 'serviceworker-server/lib/worker.js';
import { match } from 'serviceworker-server/lib/impl/webtorrent/wt-worker.js'

swserve({ match });
// client.js with a webtorrent instance in scope as `client`
import { clientserve } from 'serviceworker-server/lib/client.js';
import { match, makeHandle } from 'serviceworker-server/lib/impl/webtorrent/wt-client.js'

clientserve({ match, handle: makeHandle(client) });

Implementing your own library

1.5.0

2 years ago

1.4.0

2 years ago

1.3.2

2 years ago

1.3.1

2 years ago

1.3.0

2 years ago

1.2.4

2 years ago

1.2.3

2 years ago

1.2.2

2 years ago

1.2.1

2 years ago

1.2.0

2 years ago

1.1.0

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago