I have
fileUploadPath="d:/downloads";
and
entry.name='155ce0e4-d763-4153-909a-407dc4e328d0/63690689-e183-46ae-abbe-bb4ba5507f1a_MULTI_0_3/output/res2/res2.fcs';
when try to create res2.fcs file with following above path it shows gives me error, why it is not creating the folder structure?
code:
data.entries.forEach(entry => {
console.log(entry.name);
if (fs.existsSync(fileUploadPath)) {
var sourceFilePath = fileUploadPath + '/' + entry.name;
if (!fs.existsSync(sourceFilePath)) {
fs.mkdir(sourceFilePath, {recursive: true }, (err) => {if (err) {
console.log("Failed :" + err);
} else {
const fstream = fs.createWriteStream(require('path').format({dir: fileUploadPath, base: entry.name })); fstream.write('fileContent');
fstream.end();
fstream.on("finish", f => {
console.log(f)
});
fstream.on("error", e => {
console.log(e)
});
}
});
} else {
console.log('d');
}
} else {
console.log('ssss')
}
})
error:
[Error: ENOENT: no such file or directory, open 'D:\downloads\626a69d18d2468c5082fc6e1\MULTI_1_2022-04-28_11-00-38\output\res1\res1.fcs'] {
errno: -4058,
code: 'ENOENT',
syscall: 'open',
path: 'D:\\downloads\\626a69d18d2468c5082fc6e1\\MULTI__2022-04-28_11-00-38\\output\\res1\\res1.fcs'