Write binary files


I’d like to write a BASE64-encoded string BASE64-decoded to file, so ‘write binary’.
What I’ve done:

  • Got ‘column A’ with the BASE64-encoded string
  • Action ‘Calculate new columns’, with new column ‘column B’ and formula ‘decode(“base64”,[column a]’)
  • Action ‘Keep/remove columns’, with ‘Remove all columns but ‘column B’’
  • Action ‘Export to CSV’, with encoding ‘ASCII’ (Advanced Options)

Unfortunately, all encoding-types result in file where some characters are ‘mangled’.

Is there a possibility to really write binary files?

Thanks in advance,
Dethmer Kupers

Found a workaround, for Windows 10:

  • Use the action ‘Export into delimited textfile’ to write the BASE64-encoded string to a ASCII-file (eg c:\temp\temp.b64)
  • Call PowerShell (‘certutil -decode “{tempfile}” “{outputfile}”’) to decode the file.

Nevertheless, a ‘binary write’ wouldn’t hurt :wink:

Dethmer Kupers


Hi Dethmer and welcome to the Community!

That's a nice trick! Thanks for sharing.

thanks for pointing me in the right direction!

context: we get image data from an API. we want to save this image data as a JPEG file.

I tried using the built-in Easymorph function "decode" with parameter 'base64', but this produced files that windows couldn't display as jpegs.

I've managed to get this working without the in-between step of saving it to a delimited text file.

I have isolated the functionality in a seperate module that takes two parameters:

  1. image_data containing the base64-encoded image
  2. image_filename: the filename where I want to save it to. Be careful here: because we're using powershell you have to provide a full path to the destination location, you can't just start relatively from the easymorph project location.

the only action needed is calling this powershell script:

[System.Convert]::FromBase64String('{image_data}') | Set-Content '{image_filename}' -Encoding Byte

After getting a ton of images from the API, running this module recursively over the set produced a file for every result. Windows had no problem displaying the JPEG files.

1 Like