Instructions for the fs.rmdirSync method in node.js

  • 2020-05-05 10:57:57
  • OfStack

method description:

Synchronized version of rmdir().

A return value of null or undefined indicates a successful deletion, otherwise an exception is thrown.

syntax:


fs.rmdirSync(path)

Since this method belongs to the fs module, the fs module (var fs= require(" fs "))

needs to be introduced before use

receive parameters:

path   directory path

Example:


var fs = require('fs');
var deldir = fs.rmdirSync('deldir');
console.log(deldir);

source code:


fs.rmdirSync = function(path) {
  nullCheck(path);
  return binding.rmdir(pathModule._makeLong(path));
};


Related articles: