Corrupt javascript file after downloading files with Filezilla

Was trying to download a WordPress site from an FTP to my local dev environment but some of the javascript files was corrupt and was looking like this when I open the javascript file


I found out that when Filezilla download files down to your local machine it has “default transfer type” set to Auto. And because Filezilla could not figure out which type it was it was choosing the wrong file type in my situation.
I had to go to Settings -> Transfers -> File types and set it to Binary, and then download all the javascript assets again and now it worked and the files were not corrupted anymore.

Hope it can help someone in the future.