Well I did it way back in 1998 in C++. I wrote an api for developing cgi web apps (executables that run inside of apache web server) that accept the contents of a web form, including binary file upload.
If I recall correctly, there is a string of random looking characters that begin the chunk of text and the same string that indicates the end of the chunk. Each character is visible, so you have to subtract the offset in the ascii table to the first character to shift it down, then you have to bit twiddle 4 of these shifted values together into a 24 bit number and split that into 3 8-bit bytes.
I'm quite sure it can be done in JavaScript, since that is a text manipulation language.
I'm also sure that it's already done and out there somewhere.
Creator of LaserBoy!
LaserBoy is free and runs in Windows, MacOS and Linux (including Raspberry Pi!).
Download LaserBoy!
YouTube Tutorials
Ask me about my LaserBoy Correction Amp Kit for sale!
All software has a learning curve usually proportional to its capabilities and unique features. Pointing with a mouse is in no way easier than tapping a key.
When your browser sees that it does the conversion before it saves the file. Can you see the size of the local vs. the remote data? Not the remote file size, the size of the data coming in. If it's about 25% bigger, then you'll know.
Maybe it is binary but there is some kind of header on it that is messing up your data conversion.
Creator of LaserBoy!
LaserBoy is free and runs in Windows, MacOS and Linux (including Raspberry Pi!).
Download LaserBoy!
YouTube Tutorials
Ask me about my LaserBoy Correction Amp Kit for sale!
All software has a learning curve usually proportional to its capabilities and unique features. Pointing with a mouse is in no way easier than tapping a key.
Ok, I solved the problem.
As I mentioned, the browser downloads the raw file exactly as requested, removing any HTTP headers. There's also no byte encoding. The code is quite simple and demonstrates this:
This shows the raw ILDA file data downloaded.. even the ILDA header info parts in plaintext are visible, and the frame/point data as binary data following the header.PHP Code:
$.get(url, function(data) {$("#rawoutput").html(data);});
The problem was converting this binary data into the Javascript "ArrayBuffer" or Uint8Array format which the rendering engine required. This is a Javascript array of the actual binary file byte values -- one uint8_t byte per array element (the rendering engine later combines these bytes into larger INT16 values for XY values, etc). So for the 4 ILDA header bytes which is just "ILDA", the javascript ByteArray is: {73,76,68,65} And when this is output to the browser, this looks like an ASCII representation of each byte's decimal value, so the ILDA header is output to the web page as "73766865" and so on for the rest of the file.
You see this all demonstrated here here: https://ildac32.com/render/
There are two options.
Option 1: upload your own ILD file -- just drag/drop it to the box that says "Drop your local ILD file here". That will load the file and output the ArrayBuffer format in yellow.
Option 2: Click one of the buttons to load an .ILD file from the web server. Due to CORS restrictions, the page can't download any ILD file located elsewhere, only files on the web server. But when you click one of those buttons, the ILD file is downloaded into your browser, and you can see below the actual RAW data format downloaded (in magenta), and then the same data converted into the ArrayBuffer format (in cyan). If you watch the JS console, you can see all of this incoming data.
Once a pattern is loaded and running, you can change the render speed and size using the sliders at the top of the page.
Last edited by HankLloydRight; 02-08-2022 at 06:15.
BTW, if you want to see the raw binary data download from the webserver to see they aren't padded or encoded or plaintext ("ASCII only transmission protocol"), you can try these two curl commands:
(type "q" to exit 'less')PHP Code:
// includes HTTP headers
curl -si "https://ildac32.com/ild/AllColoursSharpDots.ild" | less
// excludes HTTP headers
curl -s "https://ildac32.com/ild/AllColoursSharpDots.ild" | less
Last edited by HankLloydRight; 02-08-2022 at 06:17.