leetcode-cli
Version:
A cli tool to enjoy leetcode!
21 lines (17 loc) • 378 B
JavaScript
'use_strict';
const fs = require('fs');
const h = {
DIR: './tmp/'
};
h.clean = function() {
if (!fs.existsSync(this.DIR))
fs.mkdirSync(this.DIR);
for (let f of fs.readdirSync(this.DIR)) {
const fullpath = this.DIR + f;
if (fs.statSync(fullpath).isDirectory())
fs.rmdirSync(fullpath);
else
fs.unlinkSync(fullpath);
}
};
module.exports = h;