โ11-20-2019 06:30 AM
Hello,
Has anyone had experience of downloading a base64 encoded ZIP file. It sounds relatively straight forward however the file that is created cannot be opened (m/s invalid file format error appears). The size of the file is almost the same as the source file, therefore I assume somewhere the process is going wrong.
Any help appreciated!
โ12-02-2019 09:04 AM
Instead of doing a split, youโll want to decode the base64 strings with Base64.decodeAsBinary() to turn them into byte arrays. You can then combine them using the Uint8Array.concat()
method (which is not documented at the moment, weโll get that fixed). The concat()
method will concatenate byte arrays and return a new byte array. The following expression puts it all together:
Uint8Array.of().concat(...$[โsoap:Bodyโ].Stream_LatestPackageResponse.Stream_LatestPackageResult.File.Chunk.map(Base64.decodeAsBinary))
Note: the concat()
is a method on an existing byte array, so the above expression first creates an empty byte array with Uint8Array.of()
so that we can pass all of the byte arrays using the spread operator (...
).
Hereโs a pipeline that demonstrates this stuff:
concat-bits_2019_12_02.slp (5.6 KB)
The MultipartWriter snap is for writing a MIME Multipart message, which is not what you are looking for here.
โ12-02-2019 05:38 AM
Anyone any ideas?
โ12-04-2019 04:01 AM
Thank you, thatโs resolved it. Works perfectly.