cache-control-esm is a JavaScript library specifically designed for parsing and formatting HTTP Cache-Control headers in strict adherence to RFC 7234. Currently at version 1.0.0, this package is a specialized fork of the `@tusbar/cache-control` library. Its primary differentiator is its explicit use of ECMAScript modules (`export default` and named exports), making it well-suited for modern bundlers and environments, especially within projects like `axios-cache-adapter`. Unlike other solutions that may bundle Express/Connect-like middleware or extensive interpretation logic, `cache-control-esm` maintains a narrow focus solely on the low-level parsing of header strings into a `CacheControl` object and formatting such objects back into valid HTTP header values. This focused approach ensures a lightweight and reliable tool for precise Cache-Control header manipulation without unnecessary overhead. Its release cadence is typically reactive to the needs of its consuming projects.
npm install cache-control-esmVerified import paths — ran on the pinned version, not inferred.
Demonstrates setting a Cache-Control header using `format` and parsing one using `parse`.
Always explicitly specify `@rascarlito/cache-control` in your `package.json` and installation commands.
Ensure your project is configured for ESM (e.g., `"type": "module"` in `package.json`) or use a bundler that correctly handles ESM imports. Always use `import` statements.
Implement your own cache interpretation logic based on the `CacheControl` object properties, or integrate with a caching library that handles this. This package is a low-level utility.
Change `const { parse } = require('@rascarlito/cache-control')` to `import { parse } from '@rascarlito/cache-control'` and ensure your Node.js environment is configured for ESM.Correct the import statement to use named imports: `import { parse } from '@rascarlito/cache-control'`.No dependency data recorded yet.