This article mainly introduces node. fs. rmdir method usage instructions. This article introduces fs. rmdir method description, syntax, receive parameters, use instances, and implement source code. For more information, see
Method description:
Delete the file directory asynchronously.
Syntax:
The code is as follows:
Fs. rmdir (path, [callback (err)])
Because this method belongs to the fs module, we need to introduce the fs module (var fs = require ("fs") before use "))
Receiving parameters:
Path directory path
Callback. the callback function passes an err exception parameter.
Example:
The code is as follows:
Var fs = require ('Fs ');
Fs. rmdir ('deldir', function (err ){
If (err ){
Console. log (err );
} Else {
Console. log ("done ");
}
});
Source code:
The code is as follows:
Fs. rmdir = function (path, callback ){
Callback = makeCallback (callback );
If (! NullCheck (path, callback) return;
Binding. rmdir (pathModule. _ makeLong (path), callback );
};