Question

I am using rubyzip on windows to zip up a directory. When I unzip the archive some of the files are smaller than they were.

Zipping should be a lossless operation so I am wondering why this is happening.

Here is the code I am using:

require 'rubygems'
require 'find'
require 'zip/zip'

output = "c:/temp/test.zip"
zos = Zip::ZipOutputStream.new(output)

path = "C:/temp/profile"
::Find.find(path) do |file|
  next if File.directory?(file)
  entry = file.sub("#{path}/", '')

  zos.put_next_entry(entry)
  zos << File.read(file)
end
zos.close

The specific files that are having an issue are from a firefox profile. cert8.db and key3.db

Running the same code under jruby on linux with the same files works as expected - all the files are the same size.

Any ideas why this is a problem on windows?

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top