function createFileName(file, folder) {
  if (!file) {
    file = FILE;
  }

  try {
    let i = 2;
    while (fs.existsSync(folder + file)) {
      console.log(`${file} already exists! Appending ${i}`);

      // result.csv -> result2.csv
      var index = file.indexOf('.');
      file = file.slice(0, index) + i + file.slice(index, file.length);

      i++;
    }
  } catch (err) {
    console.error(err);
  }
  return folder + file;
}
/**
 * Creates the file path for the .csv file
 * @param file file name of the .csv, including extension
 * @param folder folder to place the file
 */
Creates the file path for the .csv file
@param file file name of the .csv, including extension
@param folder folder to place the file
Creates the file path for the . csv file @param file file name of the . csv including extension @param folder folder to place the file
function createFileName(file, folder) {
  if (!file) {
    file = FILE;
  }
  try {
    let i = 2;
    while (fs.existsSync(folder + file)) {
      console.log(`${file} already exists! Appending ${i}`);
      var index = file.indexOf('.');
      file = file.slice(0, index) + i + file.slice(index, file.length);
      i++;
    }
  } catch (err) {
    console.error(err);
  }
  return folder + file;
}
function createFileName ( file , folder ) { if ( ! file ) { file = FILE ; } try { let i = 2 ; while ( fs . existsSync ( folder + file ) ) { console . log ( ` ${ file } ${ i } ` ) ; var index = file . indexOf ( '.' ) ; file = file . slice ( 0 , index ) + i + file . slice ( index , file . length ) ; i ++ ; } } catch ( err ) { console . error ( err ) ; } return folder + file ; }
Creates the file path for the .csv file
 @param file file name of the .csv, including extension
 @param folder folder to place the file
Creates the file path for the . csv file @param file file name of the . csv including extension @param folder folder to place the file
// result.csv -> result2.csv