To use the futimes
function from fs-extra
package in Node.js, you need to follow the following steps:
fs-extra
package using the npm command:21 chars2 lines
fs-extra
module in your Node.js script:index.tsx32 chars2 lines
futimes
function with the following syntax:index.tsx42 chars2 lines
where:
path
is a string representing the path of the file to modify its atime and mtime.atime
is a number representing the new access time of the file, in milliseconds since the Epoch.mtime
is a number representing the new modification time of the file, in milliseconds since the Epoch.callback
is a function that is called after the operation is completed. It takes an error object as its only argument, which is null if the operation is successful.Here's an example code that demonstrates how to use the futimes
function from fs-extra
:
index.tsx391 chars15 lines
gistlibby LogSnag