Method: ZipKit::FileReader#get_compressed_data_offset

Defined in:
lib/zip_kit/file_reader.rb

#get_compressed_data_offset(io:, local_file_header_offset:) ⇒ Object

Get the offset in the IO at which the actual compressed data of the file starts within the ZIP. The method will eager-read the entire local header for the file (the maximum size the local header may use), starting at the given offset, and will then compute its size. That size plus the local header offset given will be the compressed data offset of the entry (read starting at this offset to get the data).

local file header is supposed to begin @return [Fixnum] absolute offset (0-based) of where the compressed data begins for this file within the ZIP

Parameters:

  • io (#seek, #read)

    an IO-ish object the ZIP file can be read from

  • local_file_header_offset (Fixnum)

    absolute offset (0-based) where the



371
372
373
374
375
# File 'lib/zip_kit/file_reader.rb', line 371

def get_compressed_data_offset(io:, local_file_header_offset:)
  seek(io, local_file_header_offset)
  entry_recovered_from_local_file_header = read_local_file_header(io: io)
  entry_recovered_from_local_file_header.compressed_data_offset
end