Created
August 24, 2015 03:40
-
-
Save piaoger/0bfdda8fbe3ce9dfdd4f to your computer and use it in GitHub Desktop.
Set file time in node.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// set file add/mode time | |
var fs = require('fs') | |
function setFileTime(filePath, atime, mtime) { | |
fs.utimesSync(filePath, atime, mtime); | |
} | |
var date = new Date('Thu Aug 20 2015 15:10:36 GMT+0800 (CST)'); | |
setFileTime('/tmp/scache/fdf/admin.log', date, date); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment