How To Get Last Modified Timestamp Of An External File?
How to get last modified timestamp of an external file? I'm trying to use using xhr.getResponseHeader('Last-Modified'), and I am getting the pervious modified time, but not the rec
Solution 1:
You can use get response as a Blob
, pass Blob
to File
constructor to get .lastModifiedDate
property value
fetch("/path/to/file")
.then(response => response.blob())
.then(blob => {
const file = new File([blob], blob.name);
console.log(file.lastModifiedDate, file.lastModified);
});
Post a Comment for "How To Get Last Modified Timestamp Of An External File?"