When using N/https to pull a file from AWS and sto...
# suitescript
l
When using N/https to pull a file from AWS and storing the file in the file cabinet there is a data encoding mismatch with excel files. Can anyone provide some guidance on how to identify the encoding of the excel file so that I can convert it into a base64 string?
I have no issues saving image files, text files, etc. It is just xlsx files that are getting corrupted.
c
.xlsx are binary (they’re actually a .zip file under the covers)
l
So I should be looking to use something like btoa.
b
your approach is doomed if you arent receiving a base 64 encoded string back from N/https
👍 1
💯 1
if you are receiving plaintext, it means N/https decided that the content wasnt binary and it tried to encode it a utf-8
the encoding errors from doing so will destroy your file
l
ahh, so you're thinking it's already corrupted before I've even tried to touch it.