Skip to content

@salesforce/b2c-tooling-sdk / operations/content / exportContent

Function: exportContent() ​

exportContent(instance, pageIds, libraryId, outputPath, options): Promise<ContentExportResult>

Defined in: packages/b2c-tooling-sdk/src/operations/content/export.ts:127

Export specific pages (with component trees and assets) to a local directory.

This is a convenience function that:

  1. Fetches/parses the library via fetchContentLibrary
  2. Filters by page ID (exact or regex), optionally by folder
  3. Downloads static assets via WebDAV (concurrent, with progress)
  4. Writes filtered XML and assets to the output directory

Parameters ​

instance ​

B2CInstance

B2C instance

pageIds ​

string[]

Page content IDs to export

libraryId ​

string

Library ID (or site ID if isSiteLibrary)

outputPath ​

string

Output directory path

options ​

ContentExportOptions = {}

Export options

Returns ​

Promise<ContentExportResult>

Export result with statistics

Example ​

typescript
const result = await exportContent(
  instance,
  ['homepage', 'about-us'],
  'SharedLibrary',
  './export',
);
console.log(`Exported ${result.pageCount} pages, ${result.componentCount} components`);

Released under the Apache-2.0 License.