njsetn:renaming_and_removing_files
- renameSync
- unLink
var fs= require("fs"); fs.renameSync("file.js", "file.json"); fs.rename("file.js", "file.json", function(error) { if (error) { console.log(error); } else { console.log("fichier renommé"); } }); try { fs.unlinkSync("file.json"); } catch (error) { console.log(error); } fs.unLink("file.json", function(error) { if (error) { console.log(error); } else { console.log("ok"); }
njsetn/renaming_and_removing_files.txt · Last modified: 2016/03/23 22:38 by leo