Zlib error, Uncompress.run

58 views
Skip to first unread message

tom rhodes

unread,
Jul 2, 2015, 9:12:09 AM7/2/15
to haxe...@googlegroups.com
Hi,

I'm doing the following with haxe 3.2 compiling to neko and running under tora...

<code>
                var fileInput = File.read('/path/to/zipfile.zip');
var reader = new Reader(fileInput);
var entries = reader.read();
for(entry in entries)
{
if(StringTools.endsWith(entry.fileName,"/") && entry.dataSize == 0)
{
FileSystem.createDirectory("path/to/" + entry.fileName);
}
else
{
trace(entry.compressed);
var bytes = entry.compressed ? Uncompress.run(entry.data) : entry.data;
File.saveBytes("/path/to/" + entry.fileName, bytes);
}
}
</code>

I get this error for anything where entry.compressed is true, ZLib Error : unknown compression method (-3)

I seem to remember running in to this a couple of years ago, maybe less actually and I resorted to using a zip lib in JS instead of on the server where this stuff should be for my app. Is this still broken in neko? I'm using the fastcgi tora, is there a new version I can compile that fixes this issue? thanks,

Tom.

tom rhodes

unread,
Jul 2, 2015, 9:17:12 AM7/2/15
to haxe...@googlegroups.com
As a quick follow up, just tested using latest neko that came with the 3.2 linux 64 bit binaries on the command line and I get the same error, so not related to the tora fastcgi then...

neko problem?

Nicolas Cannasse

unread,
Jul 3, 2015, 4:30:21 AM7/3/15
to haxe...@googlegroups.com
Le 02/07/2015 15:17, tom rhodes a écrit :
> As a quick follow up, just tested using latest neko that came with the
> 3.2 linux 64 bit binaries on the command line and I get the same error,
> so not related to the tora fastcgi then...
>
> neko problem?

Uses haxe.zip.Reader.unzip(entry) or look at its implementation:
https://github.com/HaxeFoundation/haxe/blob/development/std/haxe/zip/Reader.hx#L195

(it uses a special code that tells that there is no ZLIB header)

Best,
Nicolas

tom rhodes

unread,
Jul 3, 2015, 5:26:01 AM7/3/15
to haxe...@googlegroups.com
Nicholas,

Thankyou so much for that, not noticed the unzip static method at all. Just out of interest, is the magic bit haxe.zip.Uncompress(-15)?

Thanks again, now I can stop the insanity of unzipping in JS :)

Tom.

--
To post to this group haxe...@googlegroups.com
http://groups.google.com/group/haxelang?hl=en
---
You received this message because you are subscribed to the Google Groups "Haxe" group.
For more options, visit https://groups.google.com/d/optout.
Reply all
Reply to author
Forward
0 new messages