function writeToFile() {
fs.open(filepath,'r',function(fileExists, file) {
if (fileExists) {
fs.writeFile( filepath, JSON.stringify(prodDetail), (err) => {
if (err) console.error(err)
console.log('Data written')
});
} else {
console.log("File already exists!");
}
});
}