I would like to know that if my csv file is Gzipped. (not tarred first, like tar.gz). And its extension is FileName.csv.gz.
What will be the file header in that case. Because i need file name, file size details from it.
When i tarred my csv to (FileName.tar). and then i gzipped it to (FileName.tar.gz). I can easily read file header. Have a look here http://e开发者_开发问答n.wikipedia.org/wiki/Tar_(file_format)#File_header
Thanks.
I'm not sure if I'm answering your question, but this might help:
gzip headers contain the original filename and the original uncompressed file size. Details are in the RFC at http://www.gzip.org/zlib/rfc-gzip.html#member-format . The only trick to reading the header is that the original file size is after a variable length field, so extracting the original file size isn't as simple as reading a few bytes from a known location.
You can use the "file" command on *nix to extract some information about the original file easily. Example:
$ file schema.gz schema.gz: gzip compressed data, was "schema", from Unix, last modified: Sat Oct 22 18:10:20 2011
精彩评论