Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const input = fs.createReadStream(path.join('src', 'client', 'js', 'sw.js'));
let precacheassetsToCache = Object.values(manifest).filter((asset) => {
return !asset.startsWith('/static/icons')});
const precacheHash = crypto.createHash('md5');
for (let asset of precacheassetsToCache) {
precacheHash.update(asset);
}
const precacheDigest = precacheHash.digest('hex');
res.set('Content-Type', 'application/javascript');
input.pipe(
staticModule({
'static-precache-version': () => JSON.stringify(precacheDigest),
'static-precache': () => JSON.stringify(precacheassetsToCache),
'static-runtime': () => JSON.stringify(RUNTIME_CACHE),
})
).pipe(res);
});