Binary gzip string not in correct gzip format
See original GitHub issuevar output = pako.gzip(“{test:‘hello world’}”, { to: ‘string’ });
fs.writeFile("./gzip-test.txt", output, function(err) {
if(err) {
return console.log(err);
}
console.log("The file was saved!");
});
Produces this output in a file:
1F C2 8B 08 00 00 00 00 00 00 03 C2 AB 2E 49 2D 2E C2 B1 52 C3 8F 48 C3 8D C3 89 C3 89 57 28 C3 8F 2F C3 8A 49 51 C2 AF 05 00 37 C2 90 12 C3 89 14 00 00 00
According to this:
http://en.wikipedia.org/wiki/Gzip
The output should start with a 1F 8B. It has a C2 in there, otherwise it looks good. I am trying to gzip a big block of JSON in the browser and send it to the backend. The Java backend is throwing an error saying that this is not in GZip format.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:4
- Comments:14 (5 by maintainers)
Top Results From Across the Web
JAVA not in gzip format error - Stack Overflow
4 Answers 4 · I found the gzip file on my computer and tried to gunzip it but it says "not in gzip...
Read more >Dissecting the GZIP format - Command Line Fanatic
Dissecting the GZIP format. In this article I describe the DEFLATE algorithm that GZIP implements and depends on. The DEFLATE algorithm uses ...
Read more >gzip — Support for gzip files — Python 3.11.1 documentation
Open a gzip-compressed file in binary or text mode, returning a file object. The filename argument can be an actual filename (a str...
Read more >Tcl Reference Manual: zlib - TMML
Return the uncompressed contents of binary string string, which must have been in gzip format. If -headerVar is given, store a dictionary describing...
Read more >Java GZIP Example - Compress and Decompress File
While decompressing a GZIP file, if it's not in GZIP format, following exception will be thrown. java.util.zip.ZipException: Not in GZIP format ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I had the same issue when trying to send the data to the server from the browser. I fixed it by doing this:
Hello, I allow myself resurrecting this thread. Here is a Java snippet to handle pako String:
Pako provided the string with: