module Tar::USTAR

Constants

RECORD_SIZE

Public Instance Methods

read_record(io) click to toggle source
# File lib/tar/ustar.rb, line 11
def read_record(io)
  record = io.read(RECORD_SIZE) || ""

  raise UnexpectedEOF, "unexpected end-of-file: attempted to read #{RECORD_SIZE} bytes from #{io}, got #{record.size}" unless record.size == RECORD_SIZE

  record
end
records(file_size) click to toggle source
# File lib/tar/ustar.rb, line 19
def records(file_size)
  (file_size - 1) / RECORD_SIZE + 1
end
records_size(file_size) click to toggle source
# File lib/tar/ustar.rb, line 23
def records_size(file_size)
  RECORD_SIZE * records(file_size)
end