Sha256: 55ce9956d63a63e48988772a3791d6b437fbf4f0e94fd0c907076739f72d3912

Contents?: true

Size: 610 Bytes

Versions: 8

Compression:

Stored size: 610 Bytes

Contents

# frozen_string_literal: true

require_relative "../lib/zip_kit"

# Predict how large a ZIP file is going to be without having access to
# the actual file contents, but using just the filenames (influences the
# file size) and the size of the files
zip_archive_size_in_bytes = ZipKit::SizeEstimator.estimate { |zip|
  # Pretend we are going to make a ZIP file which contains a few
  # MP4 files (those do not compress all too well)
  zip.add_stored_entry(filename: "MOV_1234.MP4", size: 898_090)
  zip.add_stored_entry(filename: "MOV_1235.MP4", size: 7_855_126)
}

puts zip_archive_size_in_bytes #=> 8_753_467

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
zip_kit-6.3.2 examples/archive_size_estimate.rb
zip_kit-6.3.1 examples/archive_size_estimate.rb
zip_kit-6.3.0 examples/archive_size_estimate.rb
zip_kit-6.2.2 examples/archive_size_estimate.rb
zip_kit-6.2.1 examples/archive_size_estimate.rb
zip_kit-6.2.0 examples/archive_size_estimate.rb
zip_kit-6.0.1 examples/archive_size_estimate.rb
zip_kit-6.0.0 examples/archive_size_estimate.rb