To find the last accessed date of a csv file in Typescript, you can use the fs
module that comes with Node.js. The fs.stat()
method can be used to get a stats
object that contains information about the file, including the last access time (atime
). Here's how you can do it:
index.ts263 chars14 lines
In this example, we first import the fs
module, and then define the file path of the csv file we want to check. We then use the fs.stat()
method to get a stats
object for the file, and in the callback function, we check for any errors and log the last accessed date using the stats.atime
property.
gistlibby LogSnag