Skip to content

Commit

Permalink
feat(api): #3121 scdl integration script
Browse files Browse the repository at this point in the history
- renamed var
  • Loading branch information
461OceanBd committed Jan 28, 2025
1 parent 11101b0 commit 4ffaf5a
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,17 @@ export const processFile = async (fileInfo: ScdlFileProcessingConfig) => {
}

try {
const type = path.extname(name).slice(1).toLowerCase();
const fileType = path.extname(name).slice(1).toLowerCase();
const filePath = path.join(dirPath, name);
if (type === FileExtensionEnum.CSV) {
if (fileType === FileExtensionEnum.CSV) {
const delimiter = optionalParams[0];
const quote = typeof optionalParams[1] === "string" ? optionalParams[1] : undefined;
await scdlCli.parse(filePath, producerSlug, exportDate, delimiter, quote);
} else if (type === FileExtensionEnum.XLS || type === FileExtensionEnum.XLSX) {
} else if (fileType === FileExtensionEnum.XLS || fileType === FileExtensionEnum.XLSX) {
const [pageName = undefined, rowOffset = undefined] = optionalParams;
await scdlCli.parseXls(filePath, producerSlug, exportDate, pageName, rowOffset);
} else {
console.error(`❌ Unsupported file type : ${name} (type: ${type})`);
console.error(`❌ Unsupported file type : ${name} (type: ${fileType})`);
throw new Error(`Unsupported file type : ${filePath}`);
}
successList.push(`parse data of ${producerSlug} for file ${name}`);
Expand Down

0 comments on commit 4ffaf5a

Please sign in to comment.