function saveFileSync(path, data){
console.log(path); // добавте эту строчку
let list = path.split(/[\\\/]/);
let filename = list.pop();
let filepath = list.join('/');
fs.mkdirSync(filepath, { recursive: true }, (err) => {
if (err) throw err;
});
fs.writeFileSync(path, data);
}