简体   繁体   中英

Is there any way to get the date modified of a file using Node.js?

I am trying to get the date modified of a file located on another server, and not seeing any way to do so. Is this possible to do in Node.js?

fs.stat() or fs.statSync() of fs.promises.stat() will all get you the date modified of any file you have file system access to. The .mtimeMs or .mtime property of the Stats object those return will give you the last modification time.

If you don't have file system access to the file, then you will need a server process on that other system that you can make a request to (such as an http request) and have that server process fetch the date for you and return it to you.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM