You can use the Download Validation step to perform advanced validations of CSV files such as number of rows and content.

Example code:

const csvStr = fileBuffer.toString("utf8");
return csv({
  noheader: true,
  output: "csv"
})
  .fromString(csvStr)
  .then(csvRow => {
    if (csvRow.length !== parseInt(expectedNumOfRows)) {
      return Promise.reject(
        new Error(`Number of rows doesn't match ${csvRow.length}`)
      );
    }
    if (csvRow[0][0] !== expectedText) {
      return Promise.reject(
        new Error(`Failed to find expected text ${csvRow[0][0]}`)
      );
    }
  });

Parameters - Packages and JavaScript used in this example:

  1. name: csv, type: Package, value: csvtojson@2.0.8
  2. name: expectedNumOfRows, type: JavaScript, value: '2'
  3. name: expectedText, type: JavaScript, value: 'dfdf'

see screenshot:

Did this answer your question?