Skip to content
View as Markdown
View as Markdown

@salesforce/b2c-tooling-sdk / operations/jobs / siteArchiveImportSplit

Function: siteArchiveImportSplit()

siteArchiveImportSplit(instance, dir, options): Promise<SiteArchiveImportResult[]>

Defined in: packages/b2c-tooling-sdk/src/operations/jobs/site-archive.ts:770

Imports a large site archive by splitting it into multiple archive parts that each stay under a size ceiling, then importing them sequentially.

This works around the instance-side limit on a single import archive. The strategy:

  1. Order-sensitive XML/metadata is imported first, kept together in one archive when it fits (preferred). If it must be split, it splits at top-level data-unit boundaries in dependency order, never splitting a single unit — so catalogs (and their internal references) ride together.
  2. Static assets (catalog/library static resources) are deferred to subsequent archive parts, bin-packed by compressed size. They are order-independent and attach to the units created by the XML import.

Parts are imported sequentially and the operation stops on the first failure.

Parameters

instance

B2CInstance

B2C instance to import to

dir

string

Local directory to import (must be a directory)

options

SiteArchiveImportSplitOptions = {}

Split import options

Returns

Promise<SiteArchiveImportResult[]>

One import result per archive part, in import order

Throws

Error if a single file or data unit cannot fit under maxBytes

Throws

JobExecutionError if any part's import job fails

Example

typescript
const results = await siteArchiveImportSplit(instance, './big-site-data', {
  maxBytes: 190 * 1024 * 1024,
  onPart: (p) => console.log(`Part ${p.index}/${p.total}: ${p.kind} (${p.fileCount} files)`),
});

Released under the Apache-2.0 License.