How to use the fs.rmdirSync function in fs

To help you get started, we’ve selected a few fs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github angular / angular-cli / lib / broccoli / broccoli-tree-stabilizer.js View on Github external
TreeStabilizer.prototype.rebuild = function () {
        fs.rmdirSync(this.outputPath);
        // TODO: investigate if we can use rename the directory instead to improve performance on
        // Windows
        symlinkOrCopy.sync(this.inputPath, this.outputPath);
    };
    TreeStabilizer.prototype.cleanup = function () { };
github suiteplus / nsmockup / src / destroy.js View on Github external
var rmAllDirs = (path) => {
        if (fs.existsSync(path)) {
            fs.readdirSync(path).forEach(function (file) {
                var curPath = path + '/' + file;
                if (fs.lstatSync(curPath).isDirectory()) { // recurse
                    rmAllDirs(curPath);
                } else { // delete file
                    fs.unlinkSync(curPath);
                }
            });
            fs.rmdirSync(path);
        }
    };
github robtweed / ewd.js / essentials / install.js View on Github external
var deleteDirectory = function(path) {
  var files = [];
  if( fs.existsSync(path) ) {
    files = fs.readdirSync(path);
    files.forEach(function(file,index){
      var curPath = path + "/" + file;
      if(fs.lstatSync(curPath).isDirectory()) { // recurse
        deleteDirectory(curPath);
      } 
      else { // delete file
        fs.unlinkSync(curPath);
      }
    });
    fs.rmdirSync(path);
  }
};
github teleporthq / teleport-code-generators / packages / teleport-code-generator / __tests__ / index.ts View on Github external
const removeDirectory = (dirPath: string): void => {
  if (!existsSync(dirPath)) {
    return
  }

  const files = readdirSync(dirPath)

  for (const file of files) {
    const filePath = join(dirPath, file)
    statSync(filePath).isFile() ? unlinkSync(filePath) : removeDirectory(filePath)
  }

  rmdirSync(dirPath)
}
github weexext / ucar-weex-core / tools / copy.js View on Github external
function rimraf(dir_path) {
    if (fs.existsSync(dir_path)) {
        fs.readdirSync(dir_path).forEach(function(entry) {
            let entry_path = path.join(dir_path, entry);
            if (fs.lstatSync(entry_path).isDirectory()) {
                rimraf(entry_path);
            } else {
                fs.unlinkSync(entry_path);
                console.log("delete file : " + entry_path);
            }
        });
        fs.rmdirSync(dir_path);
    }
}
github thingsinjars / Hardy / bin / hardy-CLI.js View on Github external
try {
            files = fs.readdirSync(dirPath);
        } catch (e) {
            return;
        }
        if (files.length > 0) {
            for (var i = 0; i < files.length; i++) {
                var filePath = dirPath + '/' + files[i];
                if (fs.statSync(filePath).isFile()) {
                    fs.unlinkSync(filePath);
                } else {
                    cleanDirectory(filePath);
                }
            }
        }
        fs.rmdirSync(dirPath);
    }
github jamesshore / object_playground / node_modules / jake / node_modules / utilities / lib / file.js View on Github external
_rmDir = function (dirPath) {
    var dir = path.normalize(dirPath)
      , paths = [];
    paths = fs.readdirSync(dir);
    paths.forEach(function (p) {
      var curr = path.join(dir, p);
      var stat = fs.statSync(curr);
      if (stat.isDirectory()) {
        _rmDir(curr);
      }
      else {
        fs.unlinkSync(curr);
      }
    });
    fs.rmdirSync(dir);
  };
github readium / readium-desktop / src / utils / fs.ts View on Github external
filenames = fs.readdirSync(dirPath);
    } catch (err) {
        return;
    }

    for (const filename of filenames) {
        const filePath = path.join(dirPath, filename);

        if (fs.statSync(filePath).isFile()) {
            fs.unlinkSync(filePath);
        } else {
            rmDirSync(filePath);
        }
    }

    fs.rmdirSync(dirPath);
}
github bq / corbel-js / src / session.js View on Github external
destroy: function() {
      if (this.localStorage) {
        this.localStorage.clear();
        if (corbel.Config.isNode) {
          var fs = require('fs');
          try {
            fs.rmdirSync(corbel.Session.SESSION_PATH_DIR + '/' + this.driver.guid);
          } catch (ex) {}
        } else {
          this.sessionStorage.clear();
        }
        this.localStorage = null;
      }
    }
  }, {
github opf / openproject / frontend / scripts / karma-runner.js View on Github external
function deleteFolderRecursive(path) {
  if (fs.existsSync(path)) {
    fs.readdirSync(path).forEach(function (file) {
      var curPath = path + "/" + file;

      if (fs.lstatSync(curPath).isDirectory()) {
        deleteFolderRecursive(curPath);

      } else {
        fs.unlinkSync(curPath);
      }
    });

    fs.rmdirSync(path);
  }
}

fs

This package name is not currently in use, but was formerly occupied by another package. To avoid malicious use, npm is hanging on to the package name, but loosely, and we'll probably give it to you if you want it.

ISC
Latest version published 8 years ago

Package Health Score

70 / 100
Full package analysis