You can use btoa to convert binary data to base64 string. And then atob to convert the base64 string back to binary. Depending on memory available on the device, you can just include the binary in a file.
For example the CCS811 firmware updater contains two originally 5K binaries in base64 format. The two binary, and the firmware updater code fits in ESP8266 or Pixl, so you can simply dump some binary in one source file.
Or if it's too big, (I guess, haven't tested, but should work) you can move the binaries to separate files, and require them just when you need it. And the IDE should just upload all the files and save to flash if you choose the "Save to flash" option.
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
You can use
btoa
to convert binary data to base64 string. And thenatob
to convert the base64 string back to binary. Depending on memory available on the device, you can just include the binary in a file.For example the CCS811 firmware updater contains two originally 5K binaries in base64 format. The two binary, and the firmware updater code fits in ESP8266 or Pixl, so you can simply dump some binary in one source file.
Or if it's too big, (I guess, haven't tested, but should work) you can move the binaries to separate files, and
require
them just when you need it. And the IDE should just upload all the files and save to flash if you choose the "Save to flash" option.