I am new to typescript and need to check if a certain system is installed on the machine, which is windows. I'm thinking of doing this by checking for the existence of some files, but I'm not finding how to do this check in typescript. Would anyone have any idea how to do it?
I found this approach much simpler:
import fs from 'fs';
if (fs.existsSync(path)) {
// File exists in path
} else {
// File doesn't exist in path
}
fs.stat(path, (exists) => {
if (exists == null) {
return true;
} else if (exists.code === 'ENOENT') {
return false;
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With