How to use the emptyDirSync function from fs-extra
Find comprehensive JavaScript fs-extra.emptyDirSync code examples handpicked from public code repositorys.
434 435 436 437 438 439 440 441 442 443
var gitURL = _getGitRepoAuthURL(scriptMarket); var localPath = _getLocalAbsPath(scriptMarket); var localPathTmp = `${localPath}.tmp`; // 清理目录 fs.emptyDirSync(localPathTmp); // 操作 git var git = toolkit.createGitHandler(localPathTmp); async.series([
34
185
0
+ 2 other calls in file
GitHub: mafiosnik777/enhancr
82 83 84 85 86 87 88 89 90 91
if (!fse.existsSync(output)) { fse.mkdirSync(output) }; // clear temporary files fse.emptyDirSync(cache); console.log(enhancrPrefix + " tmp directory cleared"); if (!fse.existsSync(previewPath)) { fse.mkdirSync(previewPath);
15
185
7
+ 27 other calls in file
GitHub: volumio/volumio3-backend
301 302 303 304 305 306 307 308 309
console.log('Cannot Create Personal Albumart DIR : ' + err); return res.status(500); } try { fs.emptyDirSync(customAlbumartPath); } catch (e) { console.log('Could not clear personal albumart folder: ' + e); }
28
21
4
+ 6 other calls in file
209 210 211 212 213 214 215 216 217 218
const webpack = p.join(require.resolve('webpack'), '..', '..', '..', '.bin', 'webpack') const projectWebpack = p.join(process.cwd(), 'webpack.config.js') const webpackConf = fse.pathExistsSync(projectWebpack) ? projectWebpack : p.join(__dirname, '..', 'configs', 'webpack', 'config.js') fse.emptyDirSync(buildDirectory) execSync(`${webpack} --config ${webpackConf}`, { env: { NODE_ENV: 'production', ...process.env,
73
177
16
+ 9 other calls in file
2786 2787 2788 2789 2790 2791 2792 2793 2794 2795
this.vlocity.datapacksutils.addPackageDirToSfdxProjectJson(tempSfdxLwcFolder); const mdapiTempFolder = path.join(jobInfo.tempFolder, 'mdapi'); const sfdxCommandRunner = this.vlocity.utilityservice.getSfdxCommandRunner(jobInfo); if(fs.existsSync(mdapiTempFolder)){ fs.emptyDirSync(mdapiTempFolder); } VlocityUtils.log('Running source:convert'); await sfdxCommandRunner('source:convert', {
80
94
26
+ 35 other calls in file
7 8 9 10 11 12 13 14 15 16 17 18 19
describe('Watcher', function() { let watchers = []; beforeEach(function() { fs.emptyDirSync(dataDirectory); }); afterEach(function() { watchers.forEach(watcher => watcher.close());
4
31
0
+ 3 other calls in file
GitHub: microsoft/devicescript
248 249 250 251 252 253 254 255 256 257
) { // clients const mds = ds.clientsMarkdownFiles() const mdo = "website/docs/api/clients" fs.emptyDirSync(mdo) fs.writeJSONSync(path.join(mdo, "_category_.json"), { label: "Clients", position: 1, collapsible: true,
4
24
9
1765 1766 1767 1768 1769 1770 1771 1772 1773 1774
// Define local dir as working_directory based on options.id let make_dir = path.join(RED.settings.userDir, "mcu-plugin-cache", `${options.id}${(['host', 'mod'].includes(options._mode)) ? ('-' + options._mode) : ""}`); // only preliminary for testing!! fs.emptyDirSync(make_dir) try { switch (options._mode) { case "host":
6
21
3
+ 9 other calls in file
77 78 79 80 81 82 83 84 85 86
// Write separator to separate this run from the previous one logger.info(`--------------------------------------`); logger.info(`Extraction run started`); // Empty output folders fs.emptyDirSync(upath.resolve(upath.normalize(`${config.get('ButlerSpyglass.lineageExtract.exportDir')}/`))); fs.emptyDirSync(upath.resolve(upath.normalize(`${config.get('ButlerSpyglass.scriptExtract.exportDir')}/`))); fs.emptyDirSync(upath.resolve(upath.normalize(`${config.get('ButlerSpyglass.dataConnectionExtract.exportDir')}/`))); // Get data connections
2
11
4
+ 11 other calls in file
GitHub: MetaMask/metamask-sdk
58 59 60 61 62 63 64 65 66 67
return measureFileSizesBeforeBuild(paths.appBuild); }) .then(previousFileSizes => { // Remove all content but keep the directory so that // if you're in it, you don't end up in Trash fs.emptyDirSync(paths.appBuild); // Merge with the public folder copyPublicFolder(); // Start the webpack build return build(previousFileSizes);
1
6
0
344 345 346 347 348 349 350 351 352 353 354
body: comment + content + markdown, })); } function createMarkdown(services, variables) { fs.emptyDirSync("docs/api-reference/"); fs.writeFileSync( "docs/api-reference/index.mdx", referenceTable(services, variables), "utf-8"
3
5
17
+ 3 other calls in file
123 124 125 126 127 128 129 130 131 132
fs.emptyDirSync(reportsPublishFolder); shell.exec(`cp -r ${reportsRunFolder}/* ${reportsPublishFolder}/`); console.log(`Copying reports to Bamboo publish folder ${reportsPublishFolder}`); const reportsBambooPublishFolder = 'test-reports'; fs.emptyDirSync(reportsBambooPublishFolder); shell.exec(`cp -r ${reportsRunFolder}/* ${reportsBambooPublishFolder}/`); if (status === 'FINAL') { if (fs.existsSync('cypress/artifacts')) shell.exec(`cp -r cypress/artifacts ${reportsBambooPublishFolder}/`); if (fs.existsSync('state')) shell.exec(`cp -r state ${reportsBambooPublishFolder}/`);
1
3
2
+ 38 other calls in file
GitHub: liuyibo666666/lyb-cli
81 82 83 84 85 86 87 88 89 90
default: false, message: '是否确认清空当前目录下的文件?' }); if (confirmDelete) { // 清空当前目录 fse.emptyDirSync(localPath); } } } return this.getProjectInfo();
0
2
0
33 34 35 36 37 38 39 40 41 42 43
senderEmail, senderPassword, ccArray ); const pdfPath = path.join(__dirname, "../../assets/offerLetter/pdf/"); await fsExtra.emptyDirSync(pdfPath); res.sendStatus(200); }); router.post("/admissions", async (req, res, next) => {
1
0
0
GitHub: gabrielsmm/discord-bot
47 48 49 50 51 52 53 54 55 56
}); await interaction.editReply({ content:'Baixado!', ephemeral: false }); // limpando a pasta fs.emptyDirSync('./videos'); } catch (error) { if (error.code === 40005) { interaction.editReply({ content: 'Ops, vídeo muito grande para ser enviado, desculpe.', ephemeral: false }); } else {
0
0
1
+ 13 other calls in file
GitHub: abcsFrederick/SAIP
2885 2886 2887 2888 2889 2890 2891 2892 2893 2894
let notExistFolder = 0; for(let a=0;a<unique_patient_paths.length;a++){ if (fs.existsSync(archive_root+unique_patient_paths[a])){ // console.log(results[a][1]) let dst = workSpace+'/'+req.params.experiments_name+'/'+unique_patient_names[a]+' '+unique_patient_paths[a]; fs.emptyDirSync(dst); fs.copy(archive_root+unique_patient_paths[a], dst, function (err) { ifAllCopied.push(a) if (err) {
0
0
3
+ 4 other calls in file
357 358 359 360 361 362 363 364 365
fs.copySync(sourcePath, destPath); } addPackageJson(exampleType, framework, importType, destPath); }; fs.emptyDirSync(createExamplePath(`_gen`)); if (type !== 'typescript') { // When the type == typescript we only want to generate the vanilla option and so skip all other frameworks
0
0
210
+ 3 other calls in file
72 73 74 75 76 77 78 79 80 81
process.exit(1); }); }; var buildTemplate = function () { var packageManager = fs.existsSync(paths.appYarnLock) ? "yarn" : "npm"; fs.emptyDirSync(paths.templateBuild); process.chdir(paths.template); return runCommand("".concat(packageManager, " run build")); }; buildTemplate().then(function () {
0
0
1
+ 5 other calls in file
GitHub: npreiser/sitka-utilities
186 187 188 189 190 191 192 193 194 195
if (!fs.existsSync("./tag_printer_data")) fs.mkdirSync("./tag_printer_data"); logger.info("clearing out the manifests dir now") fse.emptyDirSync("./manifests"); //empty the dir. logger.info("Fetching Product Master list from Google Sheets"); await restutils.getProductMasterList(function (status, productmap, omitmap, transportersmap) {
0
0
1
+ 3 other calls in file
fs-extra.readFileSync is the most popular function in fs-extra (9724 examples)