Is there a limit to the length of a string when it is uploaded to the RTDB? #486
-
Hello, im using the Firebase-ESP-Client lib, but before i was using the FirebaseESP32.h, the thing is that with the other library i was able to upload a VGA image (in base64) to the RTDB, but now i cannot, it doesnt arrive to firebase (the esp-32cam has no problem encrypting in base64 a vga image), but with the same function i can upload a QVGA image, so the function works. I was wondering if is there a limitation on the bytes or length when using strings? Because is strange, i dont think is a firebase console limitation because as i said i was able to upload the string without problem with the other lib. |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 4 replies
-
Conversion large image data to base64 string in this low memory device is not efficient and may limited due to Heap fragmentation. I recommend Blob and Files that already implemented in this library. The BLOB and File will be converted to base64 encoded string on the fly when you store (upload) data to RTDB database and converted back from base64 string to BLOB and File when restore (download) data from RTDB database. In your case, you can use send image data directly via Blob function or save it to file and send it later via File functions. The base64 string stores in the RTDB database using Blob and File functions will be prepended with 12 bytes of blob signature The padding of file signature is for decoded size calculation. The padding is not included in blob signature as the base64 string will be converted back to dynamic array data without decoded size calculation. If you want to read this signature prepended base64 string from RTDB database manually instead of using Blob and File functions, you need to remove the first 12 bytes signature from the data before decoding. |
Beta Was this translation helpful? Give feedback.
-
Both FirebaseESP32 and Firebase-ESP-Client libraries use the same source code for RTDB functions. The limitation is not because the library limit but Heap fragmentation I mentioned above. |
Beta Was this translation helpful? Give feedback.
Conversion large image data to base64 string in this low memory device is not efficient and may limited due to Heap fragmentation.
I recommend Blob and Files that already implemented in this library.
The BLOB and File will be converted to base64 encoded string on the fly when you store (upload) data to RTDB database and converted back from base64 string to BLOB and File when restore (download) data from RTDB database.
In your case, you can use send image data directly via Blob function or save it to file and send it later via File functions.
The base64 string stores in the RTDB database using Blob and File functions will be prepended with 12 bytes of blob signature
blob,base64,
and 12 byt…