Base64 encoder

Feature requested and implemented
yb0kli
Posts: 19
Joined: Tue Dec 27, 2022 9:05 am
Has thanked: 3 times
Been thanked: 4 times

Base64 encoder

Post by yb0kli »

I found that Annex32 now supports base64 decoder. But there is no base64 encoder. Will it be a base64 encoder function built into Annex?

Use case: I am struggling to send binary data, and currently encode to HEX string that cause the data transmission size doubled. Workable but not efficient.

Thank you.
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: Base64 encoder

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Aug 11, 2023 3:07 pm I found that Annex32 now supports base64 decoder. But there is no base64 encoder. Will it be a base64 encoder function built into Annex?

Use case: I am struggling to send binary data, and currently encode to HEX string that cause the data transmission size doubled. Workable but not efficient.

Thank you.
Yes I'll add the base64 encoder to the list
yb0kli
Posts: 19
Joined: Tue Dec 27, 2022 9:05 am
Has thanked: 3 times
Been thanked: 4 times

Re: Base64 encoder

Post by yb0kli »

Thank you very much for your great efforts :-)
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: Base64 encoder

Post by cicciocb »

Implemented in the version 1.50.8
yb0kli
Posts: 19
Joined: Tue Dec 27, 2022 9:05 am
Has thanked: 3 times
Been thanked: 4 times

Re: Base64 encoder

Post by yb0kli »

Yeay! I see this on the newest help file.

FILE.TOBASE64 source$, dest$
Convert the file defined ‘source$’ into the file defined in ‘dest$’. The source file can be in any format and will be encoded in base64 format.

Thank you for your great effort :D
yb0kli
Posts: 19
Joined: Tue Dec 27, 2022 9:05 am
Has thanked: 3 times
Been thanked: 4 times

Re: Base64 encoder

Post by yb0kli »

I was trying simple code with ESP32CAM:

Code: [Local Link Removed for Guests]

wlog camera.picture("/picture.jpg")
file.tobase64 "/picture.jpg", "/picture.txt"
wlog "converted to base64"
The module keeps restarted everytime it runs.

However, if the source file was text, it converted just fine. Does the file.tobase64 has limitation only to text file and cannot work with binary file?

Thank you.
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: Base64 encoder

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Fri Aug 25, 2023 2:01 am I was trying simple code with ESP32CAM:

Code: [Local Link Removed for Guests]

wlog camera.picture("/picture.jpg")
file.tobase64 "/picture.jpg", "/picture.txt"
wlog "converted to base64"
The module keeps restarted everytime it runs.

However, if the source file was text, it converted just fine. Does the file.tobase64 has limitation only to text file and cannot work with binary file?

Thank you.
It should work with all the kind of files.
You are right, it do not work properly.
Ill fix it.
yb0kli
Posts: 19
Joined: Tue Dec 27, 2022 9:05 am
Has thanked: 3 times
Been thanked: 4 times

Re: Base64 encoder

Post by yb0kli »

Awaiting AnnexCam new release with fixed binary base64 encoding. Thank you...
User avatar
cicciocb
Site Admin
Posts: 2058
Joined: Mon Feb 03, 2020 1:15 pm
Location: Toulouse
Has thanked: 439 times
Been thanked: 1358 times
Contact:

Re: Base64 encoder

Post by cicciocb »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 28, 2023 3:01 am Awaiting AnnexCam new release with fixed binary base64 encoding. Thank you...
It has been fixed on the esp32 and esp32-s3.
I'll release the version for the CAM very soon
rmsta
Posts: 36
Joined: Sat Feb 20, 2021 9:36 am
Location: Sindelfingen, Germany
Has thanked: 141 times
Been thanked: 10 times

Re: Base64 encoder

Post by rmsta »

[Local Link Removed for Guests] wrote: [Local Link Removed for Guests]Mon Aug 28, 2023 11:15 am
It has been fixed on the esp32 and esp32-s3.
I'll release the version for the CAM very soon
Great :D
Post Reply