I’m trying to make a script that detects a file but how do I do that?
1 Like
Can you try something like this?
const fs = require('fs');
var file = "content.json"
try {
if(fs.existsSync(file)) {
console.log(file + " was found!");
} else {
console.log(file + " could not be found, sorry!");
}
} catch (err) {
console.error(err);
}
2 Likes
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.