News:

  • October 03, 2026, 12:02:22 AM

Login with username, password and session length

Author Topic: Processing larger binary files  (Read 7477 times)

Andrew S

  • Hero Member
  • *****
  • Posts: 144
Processing larger binary files
« on: July 29, 2019, 03:21:44 PM »
I need to download a binary file to the SDCard. I'm using MQTT so my thought is to pull it via and MQTT SUBSCRIBE and write it into a byte array. My understanding is that byte arrays can't be larger than 56,000 bytes. This file may be larger than that - is my only option to create multiple byte arrays and then count received bits to push them into multiple byte arrays?

I was hoping there was a more elegant solution - does anyone have any better ideas about how to receive larger binary files so that they can be written to an SDCard file?

Thanks, Andrew.

BobO

  • Host Moderator
  • Hero Member
  • *****
  • Posts: 6176
  • Yes Pinky, Do-more will control the world!
Re: Processing larger binary files
« Reply #1 on: July 29, 2019, 03:45:31 PM »
I need to download a binary file to the SDCard. I'm using MQTT so my thought is to pull it via and MQTT SUBSCRIBE and write it into a byte array. My understanding is that byte arrays can't be larger than 56,000 bytes. This file may be larger than that - is my only option to create multiple byte arrays and then count received bits to push them into multiple byte arrays?

I was hoping there was a more elegant solution - does anyone have any better ideas about how to receive larger binary files so that they can be written to an SDCard file?

Thanks, Andrew.

Files can be written progressively. No need to store the entire file in memory before streaming to the disk.
"It has recently come to our attention that users spend 95% of their time using 5% of the available features. That might be relevant." -BobO

Andrew S

  • Hero Member
  • *****
  • Posts: 144
Re: Processing larger binary files
« Reply #2 on: July 29, 2019, 04:18:54 PM »
Marvelous. Thanks Bob.