[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Zlib file decompression EOL issue

Pierre-olivier Rioux

4/11/2008 3:07:00 PM

Hi, first thx for helping !

I'm trying to decompress some .gz files with zlip. Here's the code that
i use, taken from here
http://www.misuse.org/science/2007/09/07/ruby-zlib-buffer-error-o...
and modified to fit my needs.

File::open(compressedFilePath.sub('.gz', ''), 'wb') do |unzipped_file|
unzipped_file.binmode
gz = File::open(compressedFilePath, 'rb')
gz.binmode
begin
zis = Zlib::GzipReader.new(gz)
puts zis.os_code()
dis = zis.read
io = StringIO.new(dis)
ensure
zis.finish if zis
end
unzipped_file.write(io.read)
unzipped_file.flush
unzipped_file.fsync
gz.close
end


The problem is, when i try to decompress FAT encoded files, only the
first line is read and managed. The GzipReader ignore the rest of the
file beyond the first line:

> file object-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz
object-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz: gzip
compressed data, from FAT filesystem (MS-DOS, OS/2, NT)

No problem when it's Unix encoded:

> file error-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz
error-TS1T-AA-CS-C-0123-2005.08.31.05.01-2005.08.31.05.34.csv.gz: gzip
compressed data, was "error-TS1T-AA-CS-C-0123-2005.08", from Unix, last
modified: Thu Apr 10 14:02:51 2008


I suspect EOL issue, but i can't find a workaround. Any suggestions are
welcome.
--
Posted via http://www.ruby-....

1 Answer

Harry Weiss

12/21/2010 2:54:00 AM

0

JJ <dmr1860@gmail.com> wrote:
> On Dec 20, 5:10?pm, Yussel <jshur...@gmail.com> wrote:
> > On Dec 20, 4:59?pm, "Tilly" <femail1...@gmail.com> wrote:
> >
> > > Is everyone in the group inactive or are posts not getting through?
> >
> > > --
> > > femail1...@gmail.com
> >
> > I think it was down for a while.
> >
> > Joel


> Yes, seems like it. Coming back to normal finally ?

> Jay

I think many of the posts submitted in that period were lost. The ones
approved Motzei Shabbat did not appear, but we were able to reapprove
them from our mail box.


--
Harry J. Weiss
hjweiss@panix.com