
Security News
Attackers Are Hunting High-Impact Node.js Maintainers in a Coordinated Social Engineering Campaign
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.
precache-striping
Advanced tools
A module to handle concurrent requests with worbox-precaching
$ npm install precache-striping
You need to install the following dependencies
{
"peerDependencies": {
"workbox-precaching": ">=6.5.0",
"workbox-routing": ">=6.5.0"
}
}
6.5.x ~ 7.x.xIf you don't install them, run the fowlling command
$ npm install workobx-routing working-precaching
Your service worker(normally named sw.js or service-worker.js) might cache the assets files using workbox-precaching like this.
// in sw.js
import { precacheAndRoute } from "workbox-precaching";
declare let self: ServiceWorkerGlobalScope; // to prevent type error
precacheAndRoute(self.__WB_MANIFEST);
// in sw.js
// import { precacheAndRoute } from "workbox-precaching";
// precacheAndRoute(self.__WB_MANIFEST);
import { PrecacheStriping } from "precache-striping";
const controller = new PrecacheStriping();
controller.precacheStriping(self.__WB_MANIFEST);
precacheAndRoute(...)You can change bucket size
controller.precacheStriping(self.__WB_MANIFEST, 6);
// bucket0: [...].length 17
// bucket1: [...].length 17
// bucket2: [...].length 17
// bucket3: [...].length 17
// bucket4: [...].length 16
// bucket5: [...].length 16
If 100 assets are given, each bucket contains 16 or 17 assets
If you want pass a custom routing option,
// in sw.js
import { PrecacheStriping } from "precache-striping";
import { type PrecacheRouteOptions} from 'workbox-precaching'
const precachController = new PrecacheStriping({
optionResolver: () => ({
cleanURLs: ...,
directoryIndex: ...,
ignoreURLParametersMatching: ...,
urlManipulation: ...
} as PrecacheRouteOptions),
});
controller.precacheStriping(self.__WB_MANIFEST);
You should not use this module in conjunction with the { precacheAndRoute, precache } in workbox-precaching module.
The following sample code deletes all cached assets.
// in sw.js
import { precacheAndRoute, type PrecacheEntry } from "workbox-precaching";
import { PrecacheStriping } from "precache-striping";
const controller = new PrecacheStriping();
controller.precacheStriping(self.__WB_MANIFEST);
const moreAssets: PrecacheEntriy[] = [...]
precacheAndRoute(someMoreAssets); // (X)
precache-striping deletes the assets cached by workbox-precachingworkbox-precaching deletes the assets cached by precache-stripingInstead, call PrecacheStriping.precache() as shown in the code below
import { type PrecacheEntry } from "workbox-precaching";
import { PrecacheStriping } from "precache-striping";
const controller = new PrecacheStriping();
controller.precacheStriping(self.__WB_MANIFEST);
const moreAssets: PrecacheEntriy[] = [...]
// precacheAndRoute(someMoreAssets);
controller.precache(moreAssets)
cleanupOutdatedCaches() in workbox-precaching can be used together.
import {cleanupOutdatedCaches, type PrecacheEntry } from "workbox-precaching";
const controller = new PrecacheStriping();
controller.precacheStriping(self.__WB_MANIFEST);
const moreAssets: PrecacheEntriy[] = [...]
controller.precach(moreAssets)
cleanupOutdatedCaches()
After updating service worker(say sw#2), browser detects changes and then tries to install sw#2 and cleanupOutdatedCaches() clear outdated assets cached by sw#1
import { cleanupOutdatedCaches, type PrecacheEntry } from "workbox-precaching";
import { PrecacheStriping } from "precache-striping";
declare let self: ServiceWorkerGlobalScope;
const staticAssets: (string | PrecacheEntry)[] = self.__WB_MANIFEST;
const controller = new PrecacheStriping();
controller.precacheStriping(staticAssets, 8);
cleanupOutdatedCaches();
FAQs
Sending concurrent requests with workbox-precaching library
We found that precache-striping demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Multiple high-impact npm maintainers confirm they have been targeted in the same social engineering campaign that compromised Axios.

Security News
Axios compromise traced to social engineering, showing how attacks on maintainers can bypass controls and expose the broader software supply chain.

Security News
Node.js has paused its bug bounty program after funding ended, removing payouts for vulnerability reports but keeping its security process unchanged.