You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After several tests, I have found the solution: atime and mtime parameters must be instances of Date().
So, the final code:
// Get current date
var currentDate = new Date();
var modifiedDate = new Date(modifiedUnixTimestamp * 1000);
var fullPathOfFile = "C:/path/to/file.txt";
// File, created date, modified date
fs.utimes(fullPathOfFile, currentDate, modifiedDate, function(err){
if( err ) {
console.log(err);
}
});
Activity
[-]fs.utimes return error on Windows[/-][+]fs.utimes return errors on Windows[/+]bnoordhuis commentedon Mar 4, 2016
Can you post a complete test case? It's unclear from your example what e.g. currentUnixTimestamp contains.
simon-tannai commentedon Mar 4, 2016
After several tests, I have found the solution:
atime and mtime parameters must be instances of Date().
So, the final code:
Fix test on Windows. See nodejs/node#5561
Merge pull request #48 from trufflesuite/windows-tests
Revert "Fix test on Windows. See nodejs/node#5561"
Merge pull request #49 from trufflesuite/revert-48-windows-tests
Fix test on Windows. See nodejs/node#5561