Security News
Node.js EOL Versions CVE Dubbed the "Worst CVE of the Year" by Security Experts
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
@ampproject/toolbox-cache-url
Advanced tools
Translates an URL from the origin to the AMP Cache URL format, according to the specification available in the AMP documentation. This includes the SHA256 fallback URLs used by the AMP Cache on invalid human-readable cache urls.
Install via:
$ npm install @ampproject/toolbox-cache-url
import {ampToolboxCacheUrl} from '@ampproject/toolbox-cache-url';
const ampToolboxCacheUrl = require('@ampproject/toolbox-cache-url');
In the browser, include the UMD module in an HTML <script>
tag. If using node, replace window
with global
.
const {ampToolboxCacheUrl} = window.ToolboxCacheUrl;
// Get an AMP Cache URL from a cache domain, and a canonical URL
ampToolboxCacheUrl.createCacheUrl('cdn.ampproject.org', 'https://www.example.com').then((cacheUrl) => {
// This would log:
// 'https://www-example-com.cdn.ampproject.org/c/s/www.example.com/'
console.log(cacheUrl);
});
// Transform a canonical URL to an AMP Cache subdomain
ampToolboxCacheUrl.createCurlsSubdomain('https://www.example.com').then((curlsSubdomain) => {
// This would log:
// 'www-example-com'
console.log(curlsSubdomain);
});
FAQs
Transform canonical URLs into AMP Cache URLs
We found that @ampproject/toolbox-cache-url demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 16 open source maintainers 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
Critics call the Node.js EOL CVE a misuse of the system, sparking debate over CVE standards and the growing noise in vulnerability databases.
Security News
cURL and Go security teams are publicly rejecting CVSS as flawed for assessing vulnerabilities and are calling for more accurate, context-aware approaches.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.