How to use the @commercetools/product-json-to-csv.onStreamsFinished function in @commercetools/product-json-to-csv

To help you get started, we’ve selected a few @commercetools/product-json-to-csv examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github commercetools / nodejs / packages / product-json-to-xlsx / src / writer.js View on Github external
export function finishWorksheetsAndArchive(
  exports: Array,
  dir: string,
  output: stream$Writable,
  logger: Object
) {
  if (exports.length === 0) return archiveDir(dir, output, logger)

  const writeStreams: Array = exports.map(
    exportInfo => exportInfo.excel.stream
  )
  onStreamsFinished(writeStreams, err => {
    if (err) {
      logger.error(err)
      output.emit('error', err)
    } else {
      archiveDir(dir, output, logger)
      logger.info('All products have been written to ZIP file')
    }
  })

  // close all excel workbooks
  return exports
    .map((exportInfo: Object): Object => exportInfo.excel)
    .forEach((excel: Object) => excel.finish())
}

@commercetools/product-json-to-csv

Converts commercetools products from JSON to CSV

MIT
Latest version published 2 years ago

Package Health Score

51 / 100
Full package analysis