Instructions for the fs.rmdir method in node.js

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

method description:

Delete the file directory asynchronously.

syntax:


fs.rmdir(path, [callback(err)])

Since this method belongs to the fs module, it is necessary to introduce the fs module (var fs= require(" fs "))

before using it

receive parameters:

path   directory path

callback     callback, the callback function passes an err exception parameter.

example:


var fs = require('fs');
fs.rmdir('deldir', function(err){
 if(err){
  console.log(err);
 }else{
  console.log("done");
 }
});

source:


fs.rmdir = function(path, callback) {
  callback = makeCallback(callback);
  if (!nullCheck(path, callback)) return;
  binding.rmdir(pathModule._makeLong(path), callback);
};


Related articles: