How to use Pak file system?


As far as I understand, I have to use only Pak file system in my Heaps_io project when I build for html5 target (custom made file system I don’t consider).
Could you please explain me, how can I do this step-by-step, because it is unable to find working example. Also there is no detailed instruction in Documentation and API pages on site.

At the current moment I use Embedded file system with .png files in the ‘res’ folder. Following method is used to init: hxd.Res.initEmbed(). Obviously I should use hxd.Res.initPak() to init Pak file system, but what is an argument? Is it name of ‘res’ folder or name of .pak file?

I got from Documentation of Heaps_io (‘Resource management’ paragraph), that there is a pair of command to make .pak file from:

   haxe -hl hxd.fmt.pak.Build.hl -lib heaps -main hxd.fmt.pak.Build
   hl hxd.fmt.pak.Build.hl

Ok, I opened folder of my project in cmd.exe, run commands above and got file ‘res.null.pak’. To check result, I opened this .pak binary and found out that it contains name of my ‘temp.png’ from the ‘res’ folder. Looks good - I have .pak file…

Next, I found that I should use PAK Loader to get .pak file(s) when my html5 app will run:

   override function loadAssets(done) {
       new hxd.fmt.pak.Loader(s2d, done);
  • I added this code to my project.

At this moment I don’t know what to do next (((
How to load necessary data from the .pak file?

When I use Embedded file system, I use following method:

   var tileImage = hxd.Res.loader.load("temp.png").toTile();

But in case of PAK file system, what is a correct way?

Please, explain or give me a link to working example. Unfortunatelly, there is no example in the Github, Google or another resources. Here community forum has only 2 topics about PAK file system, but answers are not detailed and I can’t use it in my Heaps_io project.

Did you figure out how to use the pak system? Am I correct in thinking this is how you get resources to work with a Windows Executable? If not, do you know how to include images with build?