Module: Omnizip::Formats::Xar
- Defined in:
- lib/omnizip/formats/xar.rb,
lib/omnizip/formats/xar/toc.rb,
lib/omnizip/formats/xar/entry.rb,
lib/omnizip/formats/xar/header.rb,
lib/omnizip/formats/xar/reader.rb,
lib/omnizip/formats/xar/writer.rb,
lib/omnizip/formats/xar/constants.rb
Overview
XAR archive format support
XAR (eXtensible ARchive) format is primarily used on macOS for:
- Software packages (.pkg files)
- OS installers
- Software distribution
Features:
- GZIP-compressed XML Table of Contents (TOC)
- Multiple compression algorithms (gzip, bzip2, lzma, xz, none)
- Checksum verification (MD5, SHA1, SHA256, etc.)
- Extended attributes (xattrs)
- Hardlinks and symlinks
- Device nodes and FIFOs
Defined Under Namespace
Modules: Constants Classes: Entry, Header, Reader, Toc, Writer
Constant Summary collapse
- CKSUM_NONE =
Re-export constants for external access
Constants::CKSUM_NONE
- CKSUM_SHA1 =
Constants::CKSUM_SHA1
- CKSUM_MD5 =
Constants::CKSUM_MD5
- CKSUM_OTHER =
Constants::CKSUM_OTHER
Class Method Summary collapse
-
.create(path, options = {}) {|writer| ... } ⇒ String
Create XAR archive.
-
.extract(xar_path, output_dir) ⇒ Object
Extract XAR archive.
-
.info(path) ⇒ Hash
Get archive information.
-
.list(path) ⇒ Array<Entry>
List XAR archive contents.
-
.open(path) {|reader| ... } ⇒ Reader
Open XAR archive for reading.
-
.register! ⇒ Object
Auto-register XAR format when loaded.
Class Method Details
.create(path, options = {}) {|writer| ... } ⇒ String
Create XAR archive
74 75 76 77 78 |
# File 'lib/omnizip/formats/xar.rb', line 74 def create(path, = {}) Writer.create(path, ) do |writer| yield writer if block_given? end end |
.extract(xar_path, output_dir) ⇒ Object
Extract XAR archive
124 125 126 127 128 |
# File 'lib/omnizip/formats/xar.rb', line 124 def extract(xar_path, output_dir) open(xar_path) do |xar| # rubocop:disable Security/Open xar.extract_all(output_dir) end end |
.info(path) ⇒ Hash
Get archive information
139 140 141 |
# File 'lib/omnizip/formats/xar.rb', line 139 def info(path) open(path, &:info) # rubocop:disable Security/Open end |
.list(path) ⇒ Array<Entry>
List XAR archive contents
113 114 115 |
# File 'lib/omnizip/formats/xar.rb', line 113 def list(path) open(path, &:entries) # rubocop:disable Security/Open end |
.open(path) {|reader| ... } ⇒ Reader
Open XAR archive for reading
91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/omnizip/formats/xar.rb', line 91 def open(path) reader = Reader.open(path) if block_given? begin yield reader ensure reader.close end else reader end end |
.register! ⇒ Object
Auto-register XAR format when loaded
144 145 146 |
# File 'lib/omnizip/formats/xar.rb', line 144 def register! FormatRegistry.register(".xar", Reader) end |