15-11-24 02:02 PM
Hi all,
I need to know if there's any way to convert a binary data item into file, the general idea is to "invert" the built-in function of LoadBinaryFile(). Unfortunately, I can't give many details right now since I still have not started all the tests, but I'm supposed to retrieve the binary via HTTP request.
Thanks to everyone, I'll be happy to share more details when available.
15-11-24 08:52 PM
The object "Utility - File Management" has an action called "Write Binary Data". It just takes a Binary Data data item and otherwise works the same as Write Text Data. I can't remember when that action was added to the VBO (maybe it's always been there?), so if you don't have it, then the latest version of the object is here: https://digitalexchange.blueprism.com/dx/entry/3439/solution/utility---file-management .
08-05-25 02:02 PM
I have an API response which is an image stored in a Text data item in Blue Prism.
How can I convert it back to an image? Since data item is not in binary type, which method is suitable?
Thanks,
Dipin Dev P
08-05-25 02:13 PM
Usually the text will be base 64 encoded. I suppose it could be something else, but I'm just guessing it's base 64 since I've never seen anything else used for images. So I'm assuming that for the rest of the post below.
I don't think an action exists for that in the traditional, older VBOs. However, it looks like they've added an object for converting to/from Base64 strings on the DX here. In case that link breaks, the name of the asset on the DX is "Base64Encoder". I have not tried it, but that is most likely what you need.
The code to do this is not very complicated. I haven't looked inside that object, but it is likely similar to this:
public static byte[] base64_decode(string encodedData)
{
byte[] encodedDataAsBytes = Convert.FromBase64String(encodedData);
return encodedDataAsBytes;
}
That would go in the Global Code, and then from a code stage you'd pass in the string/text as an input param and output the result so it might look like this for the code at least:
YourOutputParamAsBinary = base64_decode(YourInputParamAsText);
I would say it's best to try using the object on the DX first though because it probably does work as expected and wouldn't require any coding.