break-cache
Version:
Generic cache breaker
48 lines (35 loc) • 1.75 kB
Markdown
break-cache
=========
[](https://badge.fury.io/js/break-cache)
[](https://travis-ci.org/iyegoroff/break-cache)
[](https://coveralls.io/github/iyegoroff/break-cache?branch=master)
[](https://david-dm.org/iyegoroff/break-cache)
[](https://david-dm.org/iyegoroff/break-cache#info=devDependencies)
[](https://www.npmjs.com/package/break-cache)
Searches strings inside input file and adds (or updates) current timestamp to these strings as URL query parameter.
## Installation
```bash
$ npm i break-cache
```
## Usage
### CLI
```bash
$ break-cache --input file [--match pattern] [--output file] [--param name]
```
options:<br/>
`-i, --input` - input file<br/>
`-m, --match` - regexp for searching URLs inside input file<br/>
`-o, --output` - output file (default: STDOUT)<br/>
`-p, --param` - timestamp query parameter name (default: t)<br/>
### API
```javascript
const breakCache = require('break-cache');
// options: { input: string, match?: RegExp, output?: string, param?: string }
// streamOrCallback?: stream.Writable | ((err, data) => void)
breakCache(options, stream);
```
## Example
This will add timestamps to svg badges in a readme file.
```bash
$ break-cache README.md -m '\.svg' -o README.md
```