QB64 Phoenix Edition
Bin2Data - Printable Version

+- QB64 Phoenix Edition (https://qb64phoenix.com/forum)
+-- Forum: QB64 Rising (https://qb64phoenix.com/forum/forumdisplay.php?fid=1)
+--- Forum: Prolific Programmers (https://qb64phoenix.com/forum/forumdisplay.php?fid=26)
+---- Forum: a740g (https://qb64phoenix.com/forum/forumdisplay.php?fid=56)
+---- Thread: Bin2Data (/showthread.php?tid=2228)



Bin2Data - a740g - 12-06-2023

Say hello to Bin2Data.

[Image: screenshot.png]

Bin2Data is a command-line tool that allows for the conversion of binary files to Base64 encoded DATA / CONST statements. The companion library allows for the decoding of Base64 encoded data back into its binary form. The data is optionally compressed using Google's Zopfli compression library if it sees any goodness. This means that files that are already compressed, may not go through one more compression and decompression step. The compressed data is compatible with QB64-PE's _DEFLATE$.

The original idea for this tool and library comes from two awesome tools: DAV's BASFILE and RhoSigma's MakeDATA.

So, what different about Bin2Data? Two things:
  1. It uses Google's Zopfli deflate based compressor. Zopfli is one of the best deflate compressor in the world.
  2. It can generate the data to CONSTs. Which means there is no performance hit that happens when loading files from DATA statements and string concatenation. String concatenation happens at compile time.

Get the latest source for the tool from: https://github.com/a740g/Bin2Data
Get the pre-compiled Windows binaries from https://github.com/a740g/Bin2Data/releases/latest


If you do not want to go through the effort of downloading and using the companion library from GitHub, then use the standalone version in the zip file below. It's based on the same QB64 base64 decoder that I shared here. Is has two demos - one for DATA and another for CONST.

Cheers and happy holidays!