Skip to content

Creating archives

Levels, codecs, threads and formats for arca create, including new RAR5 archives.

Last updated

Output
arca create <OUT> <INPUTS>... [-l LEVEL] [-c CODEC] [-j THREADS] [-p PASSWORD] [--hide-names] [-v SIZE] [--solid] [--recovery PERCENT] [--sfx [--console]]
OptionValuesDefaultDescription
-l, --levelstore · fast · normal · bestnormalCompression level.
-c, --codecauto · store · deflate · zstd · lzma2 · lzma · ppmd · bzip2autoDeflate in .zip, LZMA2 in .7z, .xz and .tar.xz, bzip2 in .bz2 and .tar.bz2, Zstandard in .zst and .tar.zst, the RAR compressor in .rar (auto or store only). .7z also takes lzma, ppmd, bzip2, deflate and store, see 7z.
-j, --threadsa number0ZIP, XZ, Zstandard and RAR thread limit. 0 means every core; bzip2 always uses one; 7z with LZMA2 uses every core its memory budget allows, and one with any other method.
-p, --passwordtextnoneEncrypt ZIP, 7z or RAR with AES-256.
--hide-namesflagoffEncrypt 7z or RAR headers too, so names are hidden; requires a nonempty password.
-v, --volumea size: bytes, or k, m, gnoneSplit the archive into parts of that size, out.zip.001, out.zip.002…; a .rar becomes RAR volumes out.part1.rar, out.part2.rar… instead.
--solidflagoffRAR only: compress the files as one stream.
--recovery1 to 100, with or without %noneRAR only: add a recovery record of that percentage.
--sfxflagoffMake a self-extracting Windows program instead of an archive.
--consoleflagoffWith --sfx: the program asks and reports in the console.

Levels

Terminal
arca create copy.zip my-files/ -l store    # no compression, fastestarca create copy.zip my-files/ -l fastarca create copy.zip my-files/ -l normal   # the defaultarca create copy.zip my-files/ -l best     # smallest output

Codecs

auto picks Deflate for .zip, because a zip exists so that anything can open it. Ask for Zstandard explicitly when you control the receiving side:

Terminal
arca create copy.zip my-files/ -c zstd

Threads

Arca uses every core by default. Pin the count with -j, for example on shared CI runners:

Terminal
arca create copy.zip my-files/ -j 8arca create copy.zip my-files/ -j 0    # every core (the default)

Scaling measured 1.79× on two threads, 90% efficiency, against a design requirement (R3) of at least 1.6×. See benchmarks for the command.

7z

Terminal
arca create copy.7z my-files/ -l normalarca create stored.7z my-files/ -c storearca create notes.7z logs/ -c ppmd -l bestarca create secret.7z my-files/ -c lzma2 -p "a password" --hide-names

-c picks the method; the level sets its parameters the way 7-Zip does, and -l store or -c store stores whatever else is asked:

-cMethodBest forParameters by level 1 · 5 · 6 · 9
auto, lzma2LZMA2 (default)anything; the only one on several coresdictionary 1 · 8 · 8 · 64 MiB
lzmaLZMAreaders that predate LZMA2dictionary 1 · 8 · 8 · 64 MiB
ppmdPPMdtext: logs, source code, documentsorder 4 · 6 · 8 · 32, model 1 · 16 · 32 · 192 MiB
bzip2BZip2speed with a fair ratioblocks of 100 · 500 · 600 · 900 kB
deflateDeflatethe fastest to unpackzlib level 1 · 5 · 6 · 9
storeCopydata that is already compressednone

BZip2 needs a build with the default codecs-native feature. Zstandard is not offered for 7z because 7-Zip itself cannot read it there; -c zstd applies to ZIP only, TAR ignores codec choices and .tar.gz always uses gzip.

Memory is bounded the way the LZMA2 threads are. LZMA2 runs on as many cores as fit in 2 GiB (every core at fast and normal, one at best); every other method runs on one. LZMA dictionaries and PPMd models are cut down to the size of the block they compress, so a small archive never asks a decoder for 64 MiB. The PPMd model never exceeds 192 MiB, 7-Zip's own maximum level, which is below the 256 MiB per coder that Arca's reader accepts, so every archive Arca writes it can also read.

Files are compressed together in solid blocks of up to 256 MiB, one group per filter, sorted by extension the way 7-Zip does. Each file's first bytes pick its filter, as in 7-Zip: Windows (PE), Linux (ELF) and macOS (Mach-O) programs get the branch filter of their machine, x86/x64 (BCJ), ARM, ARM-Thumb, ARM64, PowerPC, SPARC or IA-64, and PCM WAV audio gets Delta at its sample-frame size. A program whose header says nothing goes by its extension (.exe, .dll and the like get BCJ). RISC-V code gets no filter. The ARM64 filter needs 7-Zip 23.01 or later to unpack; older 7-Zip and p7zip 16.02 cannot. Entries are listed in that grouped order.

Editing a 7z in the window (deleting, renaming or adding entries) writes every block that keeps something again with its own method and filters, at the level in use; stored blocks stay stored. Files added to an archive take the method of its first block. A coder Arca cannot write again is left out, and LZMA2 replaces a method that is lost.

7z includes empty files and directories and rejects symlink/reparse-point and special-file inputs rather than following them. Creation writes a temporary archive beside the output and replaces it only on success; failure preserves an existing output. The output's parent must exist. If all inputs are empty, 7z encryption requires --hide-names so the password can actually be checked.

RAR

Terminal
arca create backup.rar documents/ notes.txt -l bestarca create stored.rar big.iso -c storearca create private.rar documents/ -p secret --hide-namesarca create photos.rar photos/ --solid -v 700m --recovery 3

Creates a new RAR5 archive that WinRAR, official UnRAR and 7-Zip open. The four levels select the RAR compressor strength; -c store equals -l store and any other explicit codec is refused. Creation uses every core by default, or as many threads as -j says, stores empty files and directories, and rejects symbolic links and special files instead of following them.

The rest is what WinRAR offers when it creates an archive:

  • --solid compresses the files as one stream, as WinRAR's -s.
  • -p encrypts every file with AES-256, as WinRAR's -p; --hide-names also encrypts the headers, as -hp, so not even the names can be listed without the password.
  • -v SIZE writes a RAR volume set, as -v: photos.part1.rar, photos.part2.rar… (part01 once there are ten or more), each at most SIZE bytes, recovery record and headers included, and at least 64 KiB. A set that fits in one volume keeps the name you gave. These are RAR's own volumes, not .001 parts.
  • --recovery PERCENT adds a recovery record of 1 to 100 percent, to each volume of a set, as -rr. arca repair and WinRAR rebuild damaged data from it. Recovery volumes (.rev) are not written.

They combine freely. RAR output is never a .cbr and never replaces an existing file, nor joins volumes with the same name: the archive or the whole set is staged beside the output, opened and decoded with Arca's reader (with the password), and published only if every name is still free. Existing RAR/CBR archives stay read-only. Limits and the complete list of refusals are in the RAR guide.

TAR and gzip

Terminal
arca create copy.tar my-files/arca create copy.tar.gz my-files/ -l bestarca create access.log.gz access.log       # one file, no container

The gzip layer honours the chosen level. TAR has nowhere to put encryption, so -p is refused for .tar, .tar.gz and .gz.

A bare .gz behaves like an .xz: it holds exactly one file, and a folder or several inputs need .tar.gz. Only auto and deflate are accepted as codecs. Reading joins every member, as gzip, pigz and cat a.gz b.gz write them, and checks each member's CRC-32 and length; trailing data that is not another member is an error. .tar.gz and .tgz are always read as TAR. A bare .gz, or a gzip file without a suffix, is looked inside: a TAR at the start makes it a .tar.gz, and anything else is one file named after the archive without .gz, so access.log.gz extracts to access.log. The name a gzip header may store is not used. gzip records only the last member's size, modulo 4 GiB, so list shows 0 for the size.

On Linux and macOS a symbolic link inside the folders being archived goes into a TAR (.tar, .tar.gz, .tar.xz) as a link, after the regular files, holding exactly the target it had. It is never followed, so a link to a folder elsewhere does not pull that folder in. Targets longer than 100 bytes go in a pax linkpath record. Whether a link is safe to recreate is decided on extraction (see Links in TAR archives). On Windows links are left out, as before.

XZ

Terminal
arca create copy.tar.xz my-files/ -l best   # .txz works tooarca create notes.txt.xz notes.txt          # one file, no container

An .xz is a compressed stream, not an archive: it holds the bytes of exactly one file and no name, date or folder. Arca refuses a folder or more than one input for it and suggests .tar.xz, which puts a TAR inside the XZ stream. Extracting notes.txt.xz writes notes.txt; a file without the suffix gets .out appended.

The levels map to xz presets: store is preset 0, fast 1, normal 6 and best 9. Even preset 0 compresses with LZMA2; XZ has no stored mode. Only auto and lzma2 are accepted as codecs, and -p and --hide-names are refused. The output carries a CRC64 check that xz and tar -J verify.

-j sets how many blocks are compressed at the same time. Each worker needs the memory of its preset, so Arca uses as many as fit in 2 GiB (one at best, up to 14 at normal) and prints the number actually used. With more than one worker the stream is split into independent blocks, which costs a little ratio. Reading is a single sequential stream. Creation writes a temporary file beside the output and renames it only on success.

bzip2 and Zstandard

Terminal
arca create copy.tar.bz2 my-files/          # .tbz2 and .tbz work tooarca create copy.tar.zst my-files/ -j 8     # .tzst works tooarca create notes.txt.bz2 notes.txt         # one file, no containerarca create notes.txt.zst notes.txt

They behave like XZ: a .bz2 or .zst holds exactly one file, and a folder or several inputs need the TAR variant. When reading, the signature decides the codec and the contents decide whether a TAR is inside, whatever the name says.

bzip2 compresses on one thread. store and fast both use its 100 kB blocks, and best its 900 kB ones. Its only accepted codec is auto. Every block and the whole stream carry a CRC that bzip2 -t and tar -j verify, and concatenated streams, as pbzip2 writes them, are read as one.

Zstandard uses the same levels as Zstandard inside a ZIP and as many threads as -j asks for; auto and zstd are accepted. Arca writes a content checksum and, for a single file, its size, so list can show it without decoding. Reading accepts windows up to 1 GiB, the same ceiling as the XZ dictionary, so frames made with zstd --long=31 are refused. Zstandard needs the default codecs-native feature.

bzip2 never records the original size, and a Zstandard stream written to a pipe may not either, so list shows 0 for them. Trailing data that is not another stream is an error.

Split volumes

Terminal
arca create backup.zip photos/ -v 700m     # backup.zip.001, backup.zip.002, …arca create backup.7z photos/ -v 4092m     # parts that fit on FAT32arca create logs.tar.xz logs/ -v 100m

-v cuts the finished archive’s bytes into parts of the given size, the way 7-Zip’s -v does: every part but the last has exactly that size, and nothing is added to them, so 7-Zip and NanaZip open the set too. The size is a number of bytes, or one ending in k, m or g for KiB, MiB and GiB. It works for ZIP, 7z, every TAR variant and the single-file streams; a .rar is not cut this way but written as RAR volumes instead (see RAR). A set has at most 9999 parts: a size too small for that is an error, and nothing is left behind.

The parts are written straight to their final folder, one after the other, so the archive never exists as one big file there; that is what lets a 4 GB set land on a FAT32 stick. They are written under temporary names and only take their real names once the whole set is complete, so a stop or an error leaves no partial set. create refuses to replace an existing .001; remove the old parts first, or pick another name. Passing backup.zip.001 as the output name is the same as passing backup.zip. When the window replaces a set, the old parts are first renamed to .arca-old and only deleted once every new part is in place; if one can’t be replaced, for instance because another program has it open, the new parts are removed and the old set is put back as it was. An .arca-old part left by a run that was cut off in between may be the only copy of the old set, so that set isn’t written again until it is moved away.

To read a set, open any of its parts: arca list backup.zip.002, arca test and arca extract find the others in the same folder and read them as one archive. Every part must be there and numbered without gaps, and every part but the last must have the same size; a missing or short part is named in the error. Part names are matched the way the file system compares them, so on Windows and macOS BACKUP.ZIP.001 finds backup.zip.002. A numbered file with no other part of its set beside it, such as a backup.zip.100 kept on its own, opens as a file of its own. A split archive is read-only: arca password and the window’s editing commands refuse it. RAR multivolume sets (.part1.rar) and split ISO images are not joined this way.

Self-extracting programs

Terminal
arca create setup.exe my-files/ --sfxarca create setup.exe my-files/ --sfx --console

--sfx writes a Windows program that carries a ZIP of the inputs. Running it shows a folder picker and extracts into the folder chosen, with the same path checks as arca extract: an entry cannot land outside that folder, and a file whose checksum does not match is not written. Files already there are replaced. If extraction fails, the folders it created and left empty are removed again. With --console the program asks for the folder in the console it was started from, and offers a folder beside itself, named after it, by default. Either kind also accepts -o FOLDER to extract there without asking, for scripts.

The program is the arca-sfx.exe that comes with Arca, installed next to arca.exe; arca create copies it, appends the ZIP and a short trailer that says where the ZIP starts. If it is not there, create says where it looked (cargo build -p arca-sfx builds it from source, and ARCA_SFX_STUB can name another copy). The ZIP inside uses Deflate or Store, so -c zstd and -c lzma2 are refused, and -p, --hide-names and -v cannot be combined with --sfx. The output is a program, so a name with an archive suffix such as .zip or .7z is refused; use .exe. Self-extractors are made for Windows; the Linux and macOS packages do not include the stub.

The ZIP counts its offsets from the start of the program, as zip -A leaves a self-extractor, so ZIP tools such as unzip -t setup.exe or .NET’s ZipFile.OpenRead read the program itself as a ZIP, and so do arca list, arca test and arca extract.

What gets stored

  • Directories are walked recursively in sorted order, so the same input always produces the same entry order.
  • Paths are stored relative to the parent of each input: arca create a.zip ~/work/site stores entries as site/….
  • Modification times are preserved.
  • ZIP adds regular files and skips symbolic links. TAR adds regular files and, on Linux and macOS, stores symbolic links as links without following them (see above). 7z and RAR also preserve empty directories and reject symbolic links (see above).

Encrypting while you create

Terminal
arca create secret.zip folder/ -p "a password"

See Encryption for the scheme, its guarantees and its limits.

Output

Output
silesia.zip: 12 files, 202.1 MB -> 63.1 MB (68.8% smaller) in 0.282 s · 717 MB/s · 24 threads