Module: Archive
- Defined in:
- lib/libarchive_rs.rb,
ext/libarchive-ruby-swig/error.cpp
Defined Under Namespace
Classes: Entry, Error, Reader, Stat, Writer
Constant Summary collapse
- ENTRY_FILE =
Stat.type_file
- ENTRY_DIRECTORY =
Stat.type_directory
- ENTRY_SYMBOLIC_LINK =
Stat.type_symbolic_link
- ENTRY_FIFO =
Stat.type_fifo
- ENTRY_SOCKET =
Stat.type_socket
- ENTRY_BLOCK_SPECIAL =
Stat.type_block_special
- ENTRY_CHARACTER_SPECIAL =
Stat.type_character_special
Class Method Summary collapse
-
.read_open_filename(filename, cmd = nil, raw = false) ⇒ Object
Open filename for reading.
-
.read_open_memory(string, cmd = nil, raw = false) ⇒ Object
Read archive from string.
-
.write_open_filename(filename, compression, format) ⇒ Object
Open filename for writing.
Class Method Details
.read_open_filename(filename, cmd = nil, raw = false) ⇒ Object
Open filename for reading. Libarchive automatically determines archive format and compression scheme. Optionally, you can specify an auxiliary command to be used for decompression.
Returns a Reader instance.
164 165 166 167 168 169 170 171 172 173 174 175 176 177 |
# File 'lib/libarchive_rs.rb', line 164 def self.read_open_filename(filename, cmd = nil, raw = false) unless cmd.nil? cmd = locate_cmd(cmd) end ar = Reader.read_open_filename(filename, cmd, raw) if block_given? yield ar ar.close() else return ar end end |
.read_open_memory(string, cmd = nil, raw = false) ⇒ Object
Read archive from string. Libarchive automatically determines archive format and compression scheme. Optionally, you can specify an auxiliary command to be used for decompression.
Returns a Reader instance.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/libarchive_rs.rb', line 187 def self.read_open_memory(string, cmd = nil, raw = false) unless cmd.nil? cmd = locate_cmd(cmd) end ar = Reader.read_open_memory(string, cmd, raw) if block_given? yield ar ar.close() else return ar end end |
.write_open_filename(filename, compression, format) ⇒ Object
Open filename for writing. Specify the compression format by passing one of the Archive::COMPRESSION_* constants or optionally specify an auxiliary program to use for compression. Use one of the Archive::FORMAT_* constants to specify the archive format.
Returns a Writer instance.
211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
# File 'lib/libarchive_rs.rb', line 211 def self.write_open_filename(filename, compression, format) if compression.is_a? String compresion = locate_cmd(compression) end ar = Writer.write_open_filename(filename, compression, format) if block_given? yield ar ar.close() else return ar end end |