Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
async process(processStream: processStream) {
for (let file of this.files) {
const filePath = path.join(this.path, file);
let sheets: (number | string)[] = [];
if (this.sheets instanceof Function) {
const allSheets = await getWorksheets({ filePath });
sheets = await this.sheets(allSheets);
} else {
sheets = this.sheets;
}
for (let i = 0; i < sheets.length; i++) {
const readStream = await getXlsxStream({
filePath,
sheet: sheets[i],
withHeader: this.hasHeader,
ignoreEmpty: this.ignoreEmpty,
});
await processStream(readStream, file, filePath, sheets[i]);
}
}
}
}
async process(processStream: processStream) {
for (let file of this.files) {
const filePath = path.join(this.path, file);
let sheets: (number | string)[] = [];
if (this.sheets instanceof Function) {
const allSheets = await getWorksheets({ filePath });
sheets = await this.sheets(allSheets);
} else {
sheets = this.sheets;
}
for (let i = 0; i < sheets.length; i++) {
const readStream = await getXlsxStream({
filePath,
sheet: sheets[i],
withHeader: this.hasHeader,
ignoreEmpty: this.ignoreEmpty,
});
await processStream(readStream, file, filePath, sheets[i]);
}
}
}
}