Open dreamapplehappy opened 8 years ago
fs.unlinkSync(path)
let result = fs.unlinkSync('./file');
console.log(result);
console.log('successfully delete ./file');
fs.rename(oldPath, newPath, callback)
fs.stat(path, callback)
fs.rename('./file', './newFile', (err) => {
if(err) {
throw err;
}
fs.stat('./newFile', (err, stats) => {
if(err) {
throw err;
}
console.log(`stats: ${JSON.stringify(stats)}`);
})
})
删除文件(Sync):
fs.unlink(path, callback)