Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
cache-control-esm
Advanced tools
Readme
Format and parse HTTP Cache-Control header
:warning: This is a fork of the original @tusbar/cache-control
package.
This package uses export default
instead of module.exports
to expose the code and was specifically modified to be
bundled by axios-cache-adapter
.
$ npm install @rascarlito/cache-control
This library exposes a CacheControl
class and two shortcut methods: parse()
and format()
.
parse(header)
import { parse } from '@rascarlito/cache-control'
parse()
takes Cache-Control
HTTP header value and returns a CacheControl
instance.
For example, parse('max-age=31536000, public')
will return
CacheControl {
maxAge: 31536000,
sharedMaxAge: null,
maxStale: false,
maxStaleDuration: null,
minFresh: null,
immutable: false,
mustRevalidate: false,
noCache: false,
noStore: false,
noTransform: false,
onlyIfCached: false,
private: false,
proxyRevalidate: false,
public: true
}
format(cacheControl)
import { format } from '@rascarlito/cache-control'
format()
takes a CacheControl
instance (or similar object) and returns a Cache-Control
HTTP header value.
For example, format({maxAge: 31536000, public: true})
will return
max-age=31536000, public
res.setHeader('Cache-Control', format({
public: true,
immutable: true
}))
Why another cache-control library?
None of the existing libraries focus on just parsing the Cache-Control
headers. There are some that expose Express (or connect-like) middlewares, and some unmaintained other ones that do rudimentary parsing of the header. The idea of this module is to parse the header according to the RFC with no further analysis or integration.
cachecontrol
: Golang HTTP Cache-Control Parser and InterpretationMIT
╚⊙ ⊙╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
╚═(███)═╝
FAQs
Format and parse HTTP Cache-Control header
The npm package cache-control-esm receives a total of 66,181 weekly downloads. As such, cache-control-esm popularity was classified as popular.
We found that cache-control-esm 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.