Move Z_STREAM_END handling to JS land. Add test for garbage input. Add gzip/gunzip modes to reset.