I use zlib.rawDeflate() to compress a zero-length data, then use zlib.rawInflate() to decompress it, however the latter throws an TypeError. Test code:
it('should decompress the raw deflated zero-length data correctly.', function () {
var data = new Uint8Array(0);
var def = zlib.rawDeflate(data);
var inf = zlib.rawInflate(def); // throws "TypeError: Reduce of empty array with no initial value"
expect(inf.length).to.equal(0);
});
I use zlib.rawDeflate() to compress a zero-length data, then use zlib.rawInflate() to decompress it, however the latter throws an TypeError. Test code: