Registry / devops / cache-breaker

cache-breaker

JSON →
library0.0.4jsnpmunverified

Cache-breaker is a utility for breaking browser caches by appending timestamps or unique strings to CSS/JS references in HTML strings. Current version 0.0.4 is in early development; the module does not interact with the file system, so users must handle file I/O themselves. It offers three modes: query string, filename insertion, and overwrite. Release cadence is unknown. Differentiators include lightweight, no-frills cache busting without a build system.

npm install cache-breaker
INSTALL
IMPORT
SIG · CACHE-BREAKER
C
cache-breaker
devopsjavascriptv0.0.4
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
const cacheBreaker = require('cache-breaker');
import cacheBreaker from 'cache-breaker';
This package uses CommonJS and does not provide ESM exports. Use require in Node.js.
breakCache
const { breakCache } = require('cache-breaker');
import { breakCache } from 'cache-breaker';
Named exports are not supported; use default import or destructure from require.

Demonstrates basic usage: breaking cache by appending a timestamp query string to specified CSS files in an HTML string.

const cacheBreaker = require('cache-breaker'); const html = '<link href="/style.css" /><link href="/style2.css" />'; const files = ['style.css', 'style2.css']; const result = cacheBreaker.breakCache(html, files); console.log(result); // Output: <link href="/style.css?rel=23452341" /><link href="/style2.css?rel=23452341" />
Debug
Known issues
gotchaPackage does not read or write files; you must handle file I/O yourself.
fix
Use fs.readFileSync/writeFileSync (or async equivalents) to process files.
affects: >=0.0.0
gotchaOnly accepts strings and arrays of strings for files; does not handle wildcards or regex patterns beyond simple string matching.
fix
Provide exact filenames or use glob patterns manually before calling the function.
affects: <=0.0.4
Errors
Common errors & fixes
Cannot find module 'cache-breaker'
Package not installed
fix
Run: npm install cache-breaker
cacheBreaker.breakCache is not a function
Incorrect import (e.g., using ES6 import)
fix
Use const cacheBreaker = require('cache-breaker');
Upgrade
Version history
0.0.4latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
2 hits · last 30 days
node
2
Resources
cache-breaker — npm install cache-breaker · libregistry