Sure, have a js script involved in generating a temporary download url.

That way someone manually downloading the file is not impacted, but if you try to put the url in a script it won’t work.

There is really no reason to add a JS dependency for this - whatever server-side component expires old URLs can just as well update the download page with the new one.