設定匯出
下載指令碼後,請更新指令碼底部的設定變數。
可以使用對AEM as a Cloud Service的權杖式驗證教學課程中的步驟來取得AEM_ACCESS_TOKEN
。 通常24小時的開發人員權杖就足夠了,只要匯出不到24小時的時間完成,而且產生權杖的使用者擁有要匯出的資產的讀取存取權即可。
...
/***** SCRIPT CONFIGURATION *****/
// AEM host is the URL of the AEM environment to download the assets from
const AEM_HOST = 'https://author-p123-e456.adobeaemcloud.com';
// AEM access token used to access the AEM host.
// This access token must have read access to the folders and assets to download.
const AEM_ACCESS_TOKEN = "eyJhbGciOiJS...zCprYZD0rSjg6g";
// The root folder in AEM to download assets from.
const AEM_ASSETS_FOLDER = '/content/dam/wknd-shared';
// The local folder to save the downloaded assets.
const LOCAL_DOWNLOAD_FOLDER = './export-assets';
// The number of maximum concurrent downloads to avoid overwhelming the client or server. 10 is typically a good value.
const MAX_CONCURRENT_DOWNLOADS = 10;
$ node export-assets.js
匯出輸出
匯出指令碼會將進度記錄到主控台,指出正在下載的資產。 指令碼完成時,資產會儲存到設定中指定的本機資料夾,且記錄會以下載資產所花費的總時間結束。
...
Downloaded asset: exported-assets/wknd-shared/en/magazine/skitouring/skitouring3sjoeberg.jpg
Downloaded asset: exported-assets/wknd-shared/en/magazine/skitouring/skitouring5sjoeberg.jpg
Downloaded asset: exported-assets/wknd-shared/en/magazine/skitouring/skitouring6sjoeberg.jpg
Downloaded asset: exported-assets/wknd-shared/en/magazine/western-australia/wa_camping_adobe.pdf
Downloaded asset: exported-assets/wknd-shared/en/magazine/western-australia/adobestock-156407519.jpeg
Downloaded asset: exported-assets/wknd-shared/en/magazine/western-australia/adobe-waadobe-wa-mg-3094.jpg
Downloaded asset: exported-assets/wknd-shared/en/magazine/western-australia/adobe-waadobe-wa-mg-3851.jpg
Downloaded asset: exported-assets/wknd-shared/en/magazine/western-australia/adobe-waadobe-wa-b6a7083.jpg
Downloaded asset: exported-assets/wknd-shared/en/magazine/western-australia/adobe-waadobe-wa-b6a6978.jpg
Download AEM assets: 24.770s
匯出的資產可在組態LOCAL_DOWNLOAD_FOLDER
中指定的本機資料夾中找到。 資料夾結構會反映AEM Assets資料夾結構,並將資產下載至適當的子資料夾。 這些檔案可以上傳至支援的雲端儲存提供者,以便大量匯入至其他AEM執行個體,或用於備份目的。