Module FS:He can manage the file system, write files, delete and so on.
Module Rimraf:Recursive deletion of the file's node plugin, before the project's file compilation, you can clear the contents of the Dist folder
API Example:
varFS = require ("FS");varRimraf = require (' Rimraf '));vartxt = "I am new content Bb.txt"; Fs.readfile ("./bb.txt", "UTF8",function(error,data) {if(Error) {Throwerror; } console.log (data);}); //Read FileFs.writefile ("./bb.txt", TXT,function(err) {if(err) {Throwerr}; Console.log ("File saved.");//file is saved});//Write FileFs.unlink ('./cc.txt ',function() {Console.log (' Success ');});//Deleting FilesFs.rename ('./bb.txt ', ' new_bb.txt ',function(Err) {Console.log (' Rename Success ');});//Modify file nameFs.stat ('./new_bb.txt ',function(err, stat) {Console.log (stat);});//View file Statusfs.exists ('./bb.txt ',function(exists) {Console.log (exists);});//determine if a file existsFs.appendfile ('./test.txt ', ' Append file contents using Fs.appendfile ',function() {Console.log (' Append content complete ');});//File Append contentFs.mkdir ('./dist ',function(err) {if(ERR)Throwerr; Console.log (' Create directory Success ')});//Create a directory
NODEJS:FS Modules & Rimraf Modules