Building an AppGyver formula helper for the community, need help with last 'download file' step 🙏

Hey all,
We’re small group trying to build a formula helper. Long story short, we’re stuck with the Download Base64 text as file (web only) logic.


The uploaded file is converted with binding to outputs["Pick files"].files[0].path
Then we convert to text with DECODE_BASE64() and do a little transformation.
Once done, we just need to download the file back to C:\user\desktop but the flow function does not trigger anything. Is it because I’m testing with the web preview?

Do you see any errors in the console?

Also fiund this:
On web, you can convert the base64 string to a downloadable file with the following code in JavaScript function box (by mapping the Get record output as the response input):

const { response } = inputs;
const { base64 } = response;
const bytes = atob(base64)
.map(c => c.charCodeAt(0));
const blob = new Blob([ new Uint8Array(bytes) ], { type: ‘application/pdf’ });
const url = URL.createObjectURL(blob);
const filename = ‘filename.pdf’;
const a = self.document.createElement(‘a’);
a.href = url;
a.setAttribute(‘download’, filename);;
return {};

Thanks, this is the Console when using the Download Base64 text as file function:

So I tried your code, which is what GPT-4 suggested to me earlier, but what it explained to me was exactly what the Download Base64 text as file (web only) logic flow function was supposed to do.

Anyway, your code is in place, adjusted input and filename. Nothing triggered. No clue about output though:thinking:

Actually, whether it is your JS code or the built-in flow function, I get the same crash due to these characters not being valid Base64 string, which is why the atob() function is failing:

I wonder if there is a bug with this?

The “metadata” data:text/plain;Base64, that is prefixed to the base64 encoding creates the unwanted characters, fixed with REPLACE().

@Kirill_Leventcov Can I understand how the Download Base64 text as file (web only) logic works. Base64Data pageVar contains 2 lines of Base64 text as expected:

What do I need to do here to trigger the window that prompts the user to select the desired save file location?

Sorry, just needed to change the default mimeType to Plain text.: