* Remove directory, deleting its content in the process | * Remove directory, deleting its content in the process | ||||
*/ | */ | ||||
exports.rmdir = function(dir) { | exports.rmdir = function(dir) { | ||||
console.log("rmdir", dir); | |||||
try { | try { | ||||
fs.accessSync(dir, fs.F_OK) | fs.accessSync(dir, fs.F_OK) | ||||
} catch (err) { | } catch (err) { |
httpStream.stop(); | httpStream.stop(); | ||||
exports.cleanupFiles.forEach(f => { | exports.cleanupFiles.forEach(f => { | ||||
fs.unlink(f, err => { if (err) console.trace(err) }); | |||||
try { | |||||
fs.unlink(f, err => { if (err) console.trace(err) }); | |||||
} catch (err) { | |||||
console.trace(err); | |||||
} | |||||
}); | }); | ||||
exports.cleanupFiles = []; | exports.cleanupFiles = []; | ||||