適用於 Node.js 的 Azure CDN 模組Azure CDN modules for Node.js

概觀Overview

Azure 內容傳遞網路 (CDN) 為開發人員提供一套傳遞高頻寬內容 (裝載在 Azure 或任何其他位置中) 的通用解決方案。The Azure Content Delivery Network (CDN) offers developers a global solution for delivering high-bandwidth content that is hosted in Azure or any other location. 使用 CDN,可讓您快取從 Azure Blob 儲存體、Web 應用程式、虛擬機器、應用程式資料夾或其他 HTTP/HTTPS 位置載入的公用物件。Using the CDN, you can cache publicly available objects loaded from Azure blob storage, a web application, virtual machine, application folder, or other HTTP/HTTPS location. CDN 快取可以保留在策略性位置上,以提供最大頻寬將內容傳遞給使用者。The CDN cache can be held at strategic locations to provide maximum bandwidth for delivering content to users. CDN 通常用來傳遞靜態內容,例如影像、樣式表、文件、檔案、用戶端指令碼和 HTML 頁面。The CDN is typically used for delivering static content such as images, style sheets, documents, files, client-side scripts, and HTML pages.

管理套件Management Package

安裝 npm 模組Install the npm module

安裝 Azure CDN npm 模組Install the Azure CDN npm module

npm install azure-arm-cdn

範例Example

此範例會列出所有的 CDN 設定檔。This example lists all of the CDN profiles.

const msRestAzure = require('ms-rest-azure');
const cdnManagementClient = require('azure-arm-cdn');

const subscriptionId = 'your-subscription-id';

msRestAzure.interactiveLogin().then(credentials => {
  const cdnClient = new cdnManagementClient(credentials, subscriptionId);
  cdnClient.profiles
    .list()
    .then(profilesList => console.log('Retrieved profiles list: ', profilesList));
});

範例Samples

深入探索可在應用程式中使用的 Node.js 程式碼範例Explore more sample Node.js code you can use in your apps.