Hi @mac338, this snippet would have to be executed after the HTTP Request in a separate Code node.
On a separate note, it might be worth checking if your server is sending the file name in a content-disposition header. This header is currently ignored by n8n, but might provide the “real” filename. You could read it like so:
If your server sends such a header, you might want to leave a vote on the corresponding feature request (so we might see support for this right in the HTTP Request node in the future): HTTP Request Node: Read filename from content-disposition header when downloading files