12-06-2023, 06:39 PM
Say hello to Bin2Data.
![[Image: screenshot.png]](https://i.ibb.co/H4pyMW5/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:
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!
![[Image: screenshot.png]](https://i.ibb.co/H4pyMW5/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:
- It uses Google's Zopfli deflate based compressor. Zopfli is one of the best deflate compressor in the world.
- 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!