Node provides asynchronous and synchronous ways to manipulate files only asynchronously, which can clog threads, not recommended
Introducing FS
var fs=require ("FS");
Read file
Fs.readfile ("D:\\bianjiqi\\web.config", function (Err,data) {
Console.log (Data.tostring ());
});
deleting files
Fs.unlink ("D:\\bianjiqi\\sss.xls", function (Err) {
if (err==null)
{
Console.log ("delete succeeded");
}
});
(different paths) cut the file and use the new file name, (same path) to modify the name
Fs.rename ("D:\\bianjiqi\\bin\\panlitao.xls", "D:\\bianjiqi\\dengxiaofen.xls", function (Err) {
if (err==null)
{
Console.log ("modified successfully");
}
});
viewing file information
Fs.stat ("D:\\bianjiqi\\dengxiaofen.xls", Function (err, stat) {
Console.log (Stat.atime);
Console.log (STAT);
});
Determine if a file exists
Fs.exists ("D:\\bianjiqi\\dengxiaofen.xls", function (exists) {
Console.log (exists? ") Existence ":" does not exist ");
});
Node Action file