Extract filename with basename() method
avelynhc opened this issue · comments
Avelyn Hyunjeong Choi commented
When you need to extract only the filename from the file path, you can use the basename() method. This function returns only the filename, so you don't need to use split in this case.
Instead of using split()
in line 138-139 helper.js
let inputFileArr = inputFile.split('/');
fileName = inputFileArr[inputFileArr.length - 1].split('.')[0];
Use path.basename()
import path from "path";
fileName = path.basename(inputFile, '.txt');
Soham Thaker commented
This issue is now fixed: 472d27e