sjmulder / nbt-js

NBT.js – a JavaScript parser for NBT archives
http://sjmulder.github.io/nbt-js/
Other
73 stars 19 forks source link

Provide a cookie cutter solution for dealing with compressed archives in the browser #30

Open sjmulder opened 7 years ago

sjmulder commented 7 years ago

Related to #5

NBT.js uses zlib.gunzip() to decompress compressed archives. This is a Node built in but in the browser a compatible library needs to be provided by the user.

The readme should either link to such a library that can be dropped in as is, or bundle its own.

dokranke commented 7 years ago

Found a library that works: zlib.js. The only thing that must be changed that instead of call: zlib.gunzip you need to call new Zlib.Gunzip(buffer).decompress. Which works without a callback.

sjmulder commented 7 years ago

As in linked issue, I'm open to PRs to use either Zlib.Gunzip or Node's zlib depending on which one is available.