Backendless Support
 
Answered

Codeless read file content

Hi all,

is it possible to read the content of a file in codeless? I only found the blocks to save files with base64 or binary data. But now I want to read a file, do something with the content and then return the content of the file to the application which is calling the API.

I tested the possibility to take the HTTP request block and read the file, that works in principle, but the content is returned in as a string? And my files contains binary data. I only get corrupted data. Is there any chance to read the files in codeless?

Or do you have plans to implement a codeless block to read the file content and maybe return the content as a list, so the single bytes can be accessed? And maybe a block to convert the bytes as a base64 string to return the content to the user in a proper way, as the codeless functions always set the content mime type of the response to application/json.

Kind regards,

Jonas

Leave a Comment

Comments (4)

photo
1

Hi Jonas

Thanks you for the report.

If you are working with plain text files it should works, I mean you can pass content as simple "String" to "Create File" block, and when you want to get the content you can use "HTTP/s" block

But, with Binary files is more complicated, I've create an internal ticket BKNDLSS-15788 for it.

We will notify you when the block is released.

In our plans to create a new block "Read File" which will return file content as BytesArray or Base64 string.

Let us know if I've missed something

Regards, Vlad

photo
1

Hi Vlad,

thanks for your response. Thats exactly what I need. Both ByteArray and Base64 string would be great.

Looking forward to your release.

Best regards, Jonas

photo
1

Hi Jonas

we just released new features, so take a look at new blocks for working with files

Regards, Vlad

photo
1

Cool, works great, thanks a lot :)