I haven’t done it myself, but I suspect what you need is a ServiceWorker, which can intermediate requests and cache assets. For client-side storage, you’ll probably want IndexedDB, which can store any content that’s object serializable (even binary data like Blobs, ArrayBuffers and typed arrays).
Discussion
This is a good start. Thank you!
Best of luck! 🙏
I’ve been doing a lot of work lately with IndexedDB. The npm library idb makes it easier to work with, strongly recommend. https://www.npmjs.com/package/idb