To use the utimes function from fs-extra in Node.js, you first need to install the module:
index.tsx21 chars2 lines
Then, you can require the module and use the utimes function to modify the access and modification times of a file:
index.tsx395 chars12 linesIn the example above, we specify the filePath of the file we want to modify and the accessTime and modifyTime with Date objects. Then, we call the utimes function and provide a callback function that will be called once the operation is finished. If an error occurs, it will be thrown. Otherwise, a success message will be printed to the console.
gistlibby LogSnag