Help with sending file in binary content encoding (not base64)

I am trying to open a file in the browser (not upload to backendless), and then send it to my CDN as “binary content encoding (not base64).”

I can open a file from a URL, and send it along to the CDN using this code (I did not write this, but it works) -

I want to open a file using FileReader() and send it along to the CDN in the same format (as it works).

This is what I have so far (Chat GPT code) -

Can someone help me understand what code I need to make it match the codeless blocks output?

Thanks,
Tim

Hi Tim,

You can already get the generated code directly from the Backendless Console for any Codless logic. Are you familiar with how to do that?

Regards,
Mark

Hi @mark-piller,

I am familiar with that. When I look at the generated code for the codeless “Read File” block, it is -

await Backendless.Request.get((function(url){ if( !url ) { throw new Error('Url must be specified.')} if( !url.startsWith('http://') && !url.startsWith('https://')) { return 'https://' + url } return url})(encodePath((typeof ___methodArguments !== 'undefined' ? ___methodArguments['fileURL'] : fileURL)))).setEncoding(null).then(result => readFileContent(null, result)));

I don’t know how to convert that logic to read a browser (local) file from an upload input and return the same formatting.

I understand.

From the Backendless support perspective, it would be outside of the charter. If anyone from the community wants to chime in, they’d most welcome.

Fair enough. Thanks @mark-piller