Class Archive::Zip::Entry::File
In: lib/archive/zip/entry.rb
Parent: Object

Archive::Zip::Entry::File represents a file entry within a Zip archive.

Methods

extract   file?   file_data   file_data=   file_path=   ftype   mode=   new   password=  

Included Modules

Archive::Zip::Entry

Attributes

file_path  [R]  The path to a file whose contents are to be used for uncompressed file data. This will be nil if the file_data attribute is set directly.

Public Class methods

Creates a new file entry where zip_path is the path to the entry in the ZIP archive. The Archive::Zip::Codec::Deflate codec with the default compression level set (NORMAL) is used by default for compression. raw_data, if specified, must be a readable, IO-like object containing possibly compressed/encrypted file data for the entry. It is intended to be used primarily by the Archive::Zip::Entry.parse class method.

Public Instance methods

Extracts this entry.

options is a Hash optionally containing the following:

:file_path:Specifies the path to which this entry will be extracted. Defaults to the zip path of this entry.
:permissions:When set to false (the default), POSIX mode/permission bits will be ignored. Otherwise, they will be restored if possible.
:ownerships:When set to false (the default), user and group ownerships will be ignored. On most systems, only a superuser is able to change ownerships, so setting this option to true as a regular user may have no effect.
:times:When set to false (the default), last accessed and last modified times will be ignored. Otherwise, they will be restored if possible.

Raises Archive::Zip::EntryError if the extracted file data appears corrupt.

Returns true.

Returns a readable, IO-like object containing uncompressed file data.

NOTE: It is the responsibility of the user of this attribute to ensure that the close method of the returned IO-like object is called when the object is no longer needed.

Sets the file_data attribute of this object to file_data. file_data must be a readable, IO-like object.

NOTE: As a side effect, the file_path and raw_data attributes for this object will be set to nil.

Sets the file_path attribute to file_path which should be a String usable with File#new to open a file for reading which will provide the IO-like object for the file_data attribute.

Returns the file type of this entry as the symbol :file.

Overridden in order to ensure that the proper mode bits are set for a file.

Sets the decryption password.

[Validate]