I am trying to write a basic JS script in NodeJs. The script will create a folder with the name of the folder to be reponses_timestamp.
I have written the attached script, however, when it runs, i receive an error which says:
Einval: invalid argument.
Any ideas on how to fix this?
Test.js
const fs = require('fs');
const today = new Date();
const date = today.getFullYear()+'-'+(today.getMonth()+1)+'-'+today.getDate();
const time = today.getHours()+":"+today.getMinutes()+":"+today.getSeconds();
const dateTime = date + '_' + time;
const uniqueIdentifier = dateTime;
// const folderName = './responses' + '_' + uniqueIdentifier;
try {
if (!fs.existsSync('./responses' + '_' + uniqueIdentifier)) {
fs.mkdirSync('./responses' + '_' + uniqueIdentifier)
}
} catch (err) {
console.error(err)
}
