nodejs - how to change creation time of file

Lapsio picture Lapsio · Aug 25, 2014 · Viewed 8.4k times · Source

fsStat class instance returns mtime, atime and ctime date objects, but there seems to be API only for changing mtime and atime (last modification and access i guess). How can i change creation time to create exact copy of file as it'd be also created the same time as original one?

Answer

Joran Greef picture Joran Greef · May 29, 2017

It's not possible at present with Node itself, but you can use https://github.com/baileyherbert/utimes (a native add-on for Node) to change the creation time (aka btime) of a file on Windows and Mac.