If I use some code like this, to start a Download with Javascript in my browser:
const link = document.createElement("a");
link.style.display = "none";
link.href = URL.createObjectURL(file);
link.download = file.name;
document.body.appendChild(link);
link.click();
Do I have any way to understand if the file has been renamed during download? I mean: if I download two times the file test.txt, the second one is renamed in something like test(1).txt.
Any chance to detect this change in the script?
Thanks!
Renaming gets done by the browser automatically if there already is a file with the same name. Therefore no.
No.
There is no API that would provide that information.
These no way to detect the filename change.
if u want avoid the duplicated download (file name duplicated) from the same page as alternative solution u can create on an array to store previous filename