Gathering detailed insights and metrics for cache-digest-immutable
Gathering detailed insights and metrics for cache-digest-immutable
Gathering detailed insights and metrics for cache-digest-immutable
Gathering detailed insights and metrics for cache-digest-immutable
npm install cache-digest-immutable
Typescript
Module System
Node Version
NPM Version
71.2
Supply Chain
79.6
Quality
75.1
Maintenance
100
Vulnerability
99.6
License
Total Downloads
2,457
Last Day
2
Last Week
5
Last Month
16
Last Year
95
Minified
Minified + Gzipped
Latest Version
1.0.1
Package Id
cache-digest-immutable@1.0.1
Size
7.05 kB
NPM Version
3.10.9
Node Version
7.2.0
Cumulative downloads
Total Downloads
Last Day
-33.3%
2
Compared to previous day
Last Week
-16.7%
5
Compared to previous week
Last Month
128.6%
16
Compared to previous month
Last Year
-49.7%
95
Compared to previous year
Uses a service worker's fetch
event and Cache API to set the cache-digest
header. Webservers use this digest to check which files the client aleady has cached. This avoids server-pushing redundant data, providing atomic cache invalidation when used in combination with filename revving (aka cache busting).
As an explicit opt-in, to avoid overly aggressive caching, this implementation only includes, in the digest, responses that have the cache-control: immutable
extension set.
1if ('serviceWorker' in navigator) { 2 addEventListener('load', function () { 3 navigator.serviceWorker.register('cache-digest-immutable.js') 4 }, {once: true}) 5}
Note: This waits until everything else on the page has loaded. This is fine since the service worker only receives fetch
events on future page loads.
draft-kazuho-h2-cache-digest-01
draft-mcmanus-immutable-00
importScripts(...)
for native module loading within Service Workers. Not meant to be compatible with alternatives like CommonJS, ES2015 Modules (export
/import
), etc.cache-control: immutable
extension is set. This makes it opt-in for server configurations and avoids overly aggressive caching. Also minimises the cache digest size to only contain assets that will be cached long-term, as opposed to short-term ephemeral resources that require revalidation.date
/expires
/cache-control
headers (incl max-age=N
/no-store
/no-cache
/must-revalidate
).btoa
function.Made by Sebastiaan Deckers in Singapore 🇸🇬
No vulnerabilities found.
No security vulnerabilities found.