🚨 Announcement: A New Chapter for Vendure read more

Importer

Importer

Package: @vendure/core File: importer.ts

Parses and imports Products using the CSV import format.

Internally it is using the ImportParser to parse the CSV file, and then the FastImporterService and the AssetImporter to actually create the resulting entities in the Vendure database.

Signature

class Importer {
  parseAndImport(input: string | Stream, ctxOrLanguageCode: RequestContext | LanguageCode, reportProgress: boolean = false) => Observable<ImportProgress>;
  async importProducts(ctx: RequestContext, rows: ParsedProductWithVariants[], onProgress: OnProgressFn) => Promise<string[]>;
}

Members

parseAndImport

method
type:
(input: string | Stream, ctxOrLanguageCode: RequestContext | LanguageCode, reportProgress: boolean = false) => Observable<ImportProgress>

Parses the contents of the product import CSV file and imports the resulting Product & ProductVariants, as well as any associated Assets, Facets & FacetValues.

The ctxOrLanguageCode argument is used to specify the languageCode to be used when creating the Products.

importProducts

async method
type:
(ctx: RequestContext, rows: ParsedProductWithVariants[], onProgress: OnProgressFn) => Promise<string[]>
Imports the products specified in the rows object. Return an array of error messages.