RE: n/File contents (base64) to Binary in Server Script
I’m trying to decode file.getContents() into Binary, in order to upload the file to another service, but it ends up corrupted.
I’ve tried using convert() from N/encode and getReader() + readChars() from N/file and neither work.
The closest I got was using the function from this gist, but it still ended up corrupted (just not as bad as other attempts).
My header for the https.post() request set ‘Content-Type’ to ‘application/octet-stream’, as that is what the server is expecting.
So I’m confused. Is Netsuite doing something on https.post()? Is there a better way to decode the Base64?
Any help would be appreciated 🙂