filetouch
Exposes a synchronous if (!fs.existsSync(...))
check around an
fs.writeFileSync
or fs.mkdirSync
call, depending on whether filetouch.dir
or filetouch.file
is called.
Files are not modified if they already exist.
const filetouch = ; // create test.txt if doesn't existfiletouch; // create test2.txt and write into it, if doesn't existfiletouch; // create test3 directory if doesn't existfiletouchdir'test3';