Greetings,
I have trouble loading a binary asset on the HTML5 target. It’s 348kB on cpp as it should be, but HTML5 is loading a 650kB byte array. I think this is because it is of the wrong type, and cpp can load anything as bytes anyway?
.bin, .dat, no extension, an arbitrary extension like .f32, or even .zip all have this problem. It’s weird that these are being loaded as text or something else.
I just realized I could fix this by including the assets like this:
But I would just like to know if there’s a file type that defaults to a binary file so I don’t have to do this and can keep using a mixed content asset directory as before.
I’m seeing this too. It looks like it’s how Haxe Bytes.ofString works on JavaScript compared to C++.
It’s possible that when we load the data as text on HTML5, it inflates the byte size by applying UTF-8 or some other format upon it, or perhaps it’s just the generic nature of the ofString method that’s implemented.
The only solution I see is either a better isText method, or loading all text on HTML5 as bytes, which may hurt performance for a large amount of text files. Open to ideas. In the short-term, I’ll add “bin” as a known binary file extension format
EDIT: Oh, it’s listed as a known extension for binary. I’ll research further