Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@ampproject/toolbox-cache-list

Package Overview
Dependencies
Maintainers
7
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ampproject/toolbox-cache-list

Lists AMP Caches

  • 1.0.0-beta.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
283
decreased by-48.17%
Maintainers
7
Weekly downloads
 
Created
Source

AMP-Toolbox Cache List

npm version

Lists known AMP Caches, as available at https://cdn.ampproject.org/caches.json.

By default, it uses a one-behind caching strategy to fetch the caches. This can be customised by passing a custom fetch strategy to the constructor.

Usage

Install via:

$ npm install @ampproject/toolbox-cache-list

List all known caches:

  const Caches = require('@ampproject/toolbox-cache-list');

  const allCaches = await Caches.list();

Which will return:

[
  {
    "id": "google",
    "name": "Google AMP Cache",
    "docs": "https://developers.google.com/amp/cache/",
    "cacheDomain": "cdn.ampproject.org",
    "updateCacheApiDomainSuffix": "cdn.ampproject.org",
    "thirdPartyFrameDomainSuffix": "ampproject.net"
  },
  {
    "id": "cloudflare",
    "name": "Cloudflare AMP Cache",
    "docs": "https://amp.cloudflare.com/",
    "cacheDomain": "amp.cloudflare.com",
    "updateCacheApiDomainSuffix": "amp.cloudflare.com",
    "thirdPartyFrameDomainSuffix": "cloudflareamp.net"
  },
  {
    "id": "bing",
    "name": "Bing AMP Cache",
    "docs": "https://www.bing.com/webmaster/help/bing-amp-cache-bc1c884c",
    "cacheDomain": "bing-amp.com",
    "updateCacheApiDomainSuffix": "bing-amp.com",
    "thirdPartyFrameDomainSuffix": "bing-amp.net"
  }
] 

Fetching info about a specific AMP cache via the cache id:

  const Caches = require('@ampproject/toolbox-cache-list');

  const googleAmpCache = await Caches.get('google');

Which will return:

{
  "id": "google",
  "name": "Google AMP Cache",
  "docs": "https://developers.google.com/amp/cache/",
  "cacheDomain": "cdn.ampproject.org",
  "updateCacheApiDomainSuffix": "cdn.ampproject.org",
  "thirdPartyFrameDomainSuffix": "ampproject.net"
}

Keywords

FAQs

Package last updated on 10 Jun 2019

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc