Instructions for using the fs.unlinksync method in node.js

  • 2020-03-30 04:36:39
  • OfStack

Method description:

Synchronous version of the unlink(), delete file operation.

Grammar:


fs.unlinkSync(path)

Since this method belongs to the fs module, the fs module (var fs= require(" fs ")) needs to be introduced before use.

Receiving parameters:

Path                    The file path

Example:


var fs = require('fs');
var filepath = '126.txt';
fs.unlinkSync(filepath);

Source:


fs.unlinkSync = function(path) {
  nullCheck(path);
  return binding.unlink(pathModule._makeLong(path));
};


Related articles: