Open
Description
We could add an optional resources
field onto ZipOptions
consisting of uninitialized RemoteResource
descriptors. A Service Worker could handle downloading these resources with Background Fetch which enables us to create rich download UIs and persistent downloads that continue when the tab is closed.
Rich download UI example screenshot:
Background Fetch example (from https://developers.google.com/web/updates/2018/12/background-fetch)
navigator.serviceWorker.ready.then(async (swReg) => {
const bgFetch = await swReg.backgroundFetch.fetch('my-fetch', ['/ep-5.mp3', 'ep-5-artwork.jpg'], {
title: 'Episode 5: Interesting things.',
icons: [{
sizes: '300x300',
src: '/ep-5-icon.png',
type: 'image/png',
}],
downloadTotal: 60 * 1024 * 1024,
});
});
Limitations
This feature might not be compatible with use cases that involve an unknown amount of async paginated resources.