To use the lutimesSync
function from the fs-extra
package in javascript, follow these steps:
fs-extra
package in your project using npm:21 chars2 lines
fs-extra
package into your javascript file as follows:index.tsx32 chars2 lines
lutimesSync
function on a file to update its access and modification times. The function takes three arguments:path
: A string representing the path to the file whose times you want to update.atime
: A Date
object representing the new access time of the file.mtime
: A Date
object representing the new modification time of the file.index.tsx67 chars3 lines
This will update the access and modification times of the file at /path/to/file
to the current time.
Note that the lutimesSync
function is synchronous and will block the main thread until it completes. If you need to update the times of multiple files asynchronously, consider using the lutimes
function instead.
gistlibby LogSnag