macOS Big Sur(macOS 11)からはコマンドで Apple Archive の圧縮・展開ができる。

macOS Big Sur からはコマンドで Apple Archive (aar や lzfse)の圧縮・展開ができるみたい。

以下、コマンドの例。

単体ファイルの圧縮

% aa archive -i alice29.txt -o alice29.txt.lzfse -a lzfse

alice29.txt を圧縮した alice29.txt.lzfse を生成する。

単体ファイルの展開

% aa extract -i alice29.txt.lzfse -o alice29.txt

alice29.txt.lzfse を展開した alice29.txt を生成する。

フォルダの圧縮

% aa archive -D target_dir -o target_dir.aar -a lzfse

target_dir フォルダを圧縮した target_dir.aar を生成する。

フォルダの展開

% aa extract -i target_dir.aar -o target_dir  

target_dir.aar を展開した target_dir フォルダ を生成する。


コマンドのオプションなどは、こんな感じ。

% aa
Usage: aa command <options>

Commands:

   archive                    archive the contents of a directory
   extract                    extract files from an archive
   list                       list the contents of an archive
   convert                    convert an archive into another
   manifest                   alias for 'archive -manifest'
   verify                     compare dir contents with manifest
   check-and-fix              check and fix dir contents using manifest

Options:

   -v                         Increase verbosity level to stderr. Default is silent operation
   -h                         Show usage and quit
   -t n_threads               Number of threads to run for compression/decompression,
                              default 8 on this machine
   -wt n_threads              Number of writer threads to run (extract only),
                              default is number of worker threads
   -d dir                     Target directory for archive/extract,
                              default is current directory
   -subdir subdir             Target subdirectory under 'dir', name will be included in the archive
                              default is empty
   -D dir_and_subdir          Defines both 'dir' (dirname) and 'subdir' (basename)
   -i input_file              Input file, default is stdin
   -o output_file             Output file, default is stdout
   -a algorithm               Algorithm for archive compression, one of lzfse, lzma, zlib, lz4, raw (no compression),
   -b block_size              Blocks size for archive compression, integer with an optional suffix b, k, m, g
                              default compression options for archive: -a lzfse -b 4m
                              default compression options for other commands: -a lzfse -b 1m
   -enable-dedup (-no-enable-dedup)
                              If set, and SLC fields are present in the archive,
                              files with same data will be extracted as clones
                              Default is -no-enable-dedup
   -enable-holes (-no-enable-holes)
                              If set, and the filesystem supports it, detect and create
                              holes in files to store 0-filled segments
                              Default is -no-enable-holes
   -ignore-eperm (-no-ignore-eperm)
                              If set, ignore EPERM (operation not permitted) errors when setting files attributes
                              Default is -ignore-eperm
   -manifest                  Alias for the following options:
                              -exclude-field dat
                              -include-field sh1,cks,siz
                              -a lzfse -b 1m
   -list-format format        Output format for list, one of text, json                              default is text

Entry selection:

   -include-path path         Include entries matching `path`
   -exclude-path path         Exclude entries matching `path`
   -include-path-list file    File containing a list of paths to include with -include-path
                              (one per line, empty lines ignored)
   -exclude-path-list file    File containing a list of paths to exclude with -exclude-path
                              (one per line, empty lines ignored)
   -include-regex expr        Include entries matching `expr` (regex(3) syntax)
   -exclude-regex expr        Exclude entries matching `expr` (regex(3) syntax)
   -exclude-name name         Exclude entries with a path component equal to `name`

                              All the options above can be specified multiple times


Archive fields:

   -include-field fields      Add `fields` to the field key set
   -exclude-field fields      Remove `fields` from the field key set

                              `fields` is a comma separated list of fields, listed below
                              These options can be specified multiple times

   typ                        entry type (always included)
   pat                        entry path (always included for filesystem objects)
   lnk                        link path (always included for symbolic links)
   dev                        device id (always included for block/character devices)
   uid                        user id
   gid                        group id
   mod                        access mode
   flg                        BSD flags
   mtm                        modification time
   btm                        backup time
   ctm                        creation time
   dat                        file data
   siz                        file data size
   cks                        file data digest, POSIX 1003.2-1992 32 bit CRC
   sh1                        file data SHA-1 digest
   sh2                        file data SHA-256 digest
   sh3                        file data SHA-384 digest
   sh5                        file data SHA-512 digest
   xat                        extended attributes
   acl                        access control list
   duz                        file disk usage
   idx                        entry index in input archive
   yec                        file data error correcting codes
   yaf                        list of archive fields (metadata entry)
   attr                       alias for uid,gid,mod,flg,mtm,btm,ctm
   all                        alias for all fields (exclude only)

Entry types:

   -include-type types        Include only entries matching `types`
   -exclude-type types        Include only entries not matching `types`

                              `types` is a string including one or more of the characters below

   b                          block special
   c                          character special
   d                          directory
   f                          regular file
   h                          hard link
   l                          symbolic link
   m                          metadata entry (not a filesystem object)
   p                          fifo
   s                          socket