R
rpardee
Hey All,
I'm having trouble unzipping a large .zip file w/rubyzip on winxp. The
file is actually in the public domain--it's this 59MB chunk of census
data:
ftp://ftp2.census.gov/census_2000/datasets/Summary_File_1/California/ca00002_uf1.zip
If I point the following script at it:
require "rubygems"
require_gem "rubyzip"
folder = "//mpe04n/vdw$/census/"
fname = folder + "ca00008_uf3.zip"
z = Zip::ZipFile.new(fname)
Zip::ZipFile.foreach(fname) do |zipentry|
# puts(zipentry.methods)
z.extract(zipentry, folder + zipentry.to_s)
end
I get:
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:201:in
`inflate': buffer error (Zlib::BufError)
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:201:in
`internal_produce_input'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:178:in
`sysread'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:124:in
`sysread'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/ioextras.rb:54:in
`read'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1242:in
`write_file'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1242:in
`get_input_stream'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1242:in
`write_file'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1240:in
`open'
... 6 levels...
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1062:in
`foreach'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1060:in
`open'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1060:in
`foreach'
from C:/Documents and Settings/pardre1/Desktop/DeleteMe.rb:11
PKZip can unzip this file w/out errors or warnings.
Can anybody advise me on how to successfully unzip this file w/ruby?
Thanks!
-Roy
I'm having trouble unzipping a large .zip file w/rubyzip on winxp. The
file is actually in the public domain--it's this 59MB chunk of census
data:
ftp://ftp2.census.gov/census_2000/datasets/Summary_File_1/California/ca00002_uf1.zip
If I point the following script at it:
require "rubygems"
require_gem "rubyzip"
folder = "//mpe04n/vdw$/census/"
fname = folder + "ca00008_uf3.zip"
z = Zip::ZipFile.new(fname)
Zip::ZipFile.foreach(fname) do |zipentry|
# puts(zipentry.methods)
z.extract(zipentry, folder + zipentry.to_s)
end
I get:
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:201:in
`inflate': buffer error (Zlib::BufError)
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:201:in
`internal_produce_input'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:178:in
`sysread'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:124:in
`sysread'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/ioextras.rb:54:in
`read'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1242:in
`write_file'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1242:in
`get_input_stream'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1242:in
`write_file'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1240:in
`open'
... 6 levels...
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1062:in
`foreach'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1060:in
`open'
from
c:/ruby/lib/ruby/gems/1.8/gems/rubyzip-0.5.12/lib/zip/zip.rb:1060:in
`foreach'
from C:/Documents and Settings/pardre1/Desktop/DeleteMe.rb:11
PKZip can unzip this file w/out errors or warnings.
Can anybody advise me on how to successfully unzip this file w/ruby?
Thanks!
-Roy