I'm trying to programmatically download a pre-signed S3 URL. I know that the file I'm downloading is an ASCII-text file. When downloading the URL by copy-paste into Chrome, the file is indeed as I would expect (see below). However, with wget the downloaded file is binary.
Looking into previous posts about this, unfortunately I couldn't find much that helped me. The posts suggest to add quotes around the URL, but my URL does not contain special characters. Some of the posts I checked: Amazon AWS S3 signed URL via Wget, https://superuser.com/questions/1311516/curl-can-not-download-file-but-browser-can. (I actually double-checked anyway with double and single quotes, neither worked in my case).
➜ wget --no-check-certificate --no-proxy "https://s3.eu-central-1.amazonaws.com/.../text_file.txt"
--2022-07-28 10:49:57-- https://s3.eu-central-1.amazonaws.com/.../text_file.txt
Resolving s3.eu-central-1.amazonaws.com (s3.eu-central-1.amazonaws.com)... 52.219.75.159
Connecting to s3.eu-central-1.amazonaws.com (s3.eu-central-1.amazonaws.com)|52.219.75.159|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 21110 (21K) [binary/octet-stream]
Saving to: ‘text_file.txt’
text_file.txt 100%[===========================================================================================================>] 20.62K --.-KB/s in 0.004s
2022-07-28 10:49:57 (5.61 MB/s) - ‘text_file.txt’ saved [21110/21110]
➜ file text_file.txt
text_file.txt: data
➜ cat text_file.txt | head -n 1
[78!???ÊBz?j????X?????x>??_uߩi??a?Qqax?W?ϴ??_c????H???u?c??}???U??5?M?|A?-9?H?Y??\?՟??B?l
2ɯL????:?JZF㽬???,2?gn????Y~vU?l4?O`?!???r ?h?1?]??f???
?MIUM??_??q?u?dC???v?MbcI>?R??oV???&?
# Following lines are for a file downloaded by copy-paste of the URL to a Chrome window
➜ file text_file\ \(1\).txt
text_file (1).txt: ASCII text
➜ cat text_file\ \(1\).txt| head -n 1
# Header of file