Rarfile

Latest version: v4.2

Safety actively analyzes 681812 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

4.2

Features:

- Support `unrar-free` \>= 0.2.0. \[[\103](https://github.com/markokr/rarfile/pull/103)\]
- Add `RarFile.is_solid` to check if archive uses solid compression. \[[\101](https://github.com/markokr/rarfile/issues/101)\]

Fixes:

- Support old multi-volume archives better where ENDARC does not contain NEXTVOL. \[[\97](https://github.com/markokr/rarfile/issues/97)\]

Cleanups:

- ci: Drop Python 3.7, add 3.12
- ci: upgrade actions

4.1

Features:

- Support 7zip/p7zip as decompression backend. \[[\71](https://github.com/markokr/rarfile/issues/71)\]
- RAR5: check password before trying to read file (chigusa) \[[\79](https://github.com/markokr/rarfile/pull/79)\]

New APIs:

- Make get\_rar\_version a public function (Safihre) \[[\63](https://github.com/markokr/rarfile/pull/63)\]
- New option: `part_only` for `RarFile`, to read only single file and allow it to be middle-part of multi-volume archive.
- Add `RarFile.printdir`, use it in dumprar. Needed to examine FILE\_COPY or HARD\_LINK entries that do not contain data.

Fixes:

- Use OS separator to access filename. Should fix subdirectory entry access on Windows. \[[\96](https://github.com/markokr/rarfile/pull/96)\]
- DirectReader: check seek position on each read. Fixes read reading from multiple entries in parallel on RarFile backed by file object. \[[\81](https://github.com/markokr/rarfile/pull/81)\]
- DirectReader: properly disable CRC check when seeking. \[[\73](https://github.com/markokr/rarfile/issues/73)\]
- Reset \_hdrenc\_main before processing a new volume. Fixes CRC checks on multi-volume reads. \[[\80](https://github.com/markokr/rarfile/pull/80)\]
- Adapt to Python 3.10 argparse (MeggyCal) \[[\85](https://github.com/markokr/rarfile/pull/85)\]
- SFX: Handle volume numbering special cases better.
- nsdatetime: support pypy internal use
- Throw error if backend does not support passwords.

Cleanups:

- ci: Use proper unrar on Windows. MingW one tolaretes paths with `/` better than upstream build.
- ci: Add Python 3.10 to the testing (Christian Clauss) \[[\76](https://github.com/markokr/rarfile/pull/76)\]
- Avoid isascii, not in 3.6

4.0

Main goals are:

- Increased `zipfile`-compatibility, thus also achieving smaller difference between RAR3 and RAR5 archives.
- Implement `RarFile.extract` on top of `RarFile.open` instead using `unrar x` directly, thus making maintenance of alternative backends more manageable. Negative aspect of that is that there are features that internal extract code does not support - hard links, NTFS streams and junctions.

Breaking changes:

- Directory names will have "/" appended. \[[\31](https://github.com/markokr/rarfile/issues/31)\]
- `RarFile.extract` operates only on single entry, so when used on directory it will create directory but not extract files under it.
- `RarFile.extract`/`RarFile.extractall`/`RarFile.testrar` will not launch special unrar command line, instead they are implemented on top of `RarFile.open`.
- Keyword args in top-level APIs were renamed to match zipfile:
- RarFile(rarfile) -\> RarFile(file)
- RarFile.setpassword(password) -\> .setpassword(pwd)
- RarFile.getinfo(fname) -\> .getinfo(name)
- RarFile.open(fname, mode, psw) -\> .open(name, mode, pwd)
- RarFile.read(fname, psw) -\> .read(name, pwd)
- `PATH_SEP` cannot be changed from "/".

New features:

- `RarFile.extract` will return final sanitized filename for target file. \[[\42](https://github.com/markokr/rarfile/issues/42), [\#52](https://github.com/markokr/rarfile/issues/52)\]
- `RarInfo.is_dir` is now preferred spelling of `isdir()`. Old method kept as alias. \[[\44](https://github.com/markokr/rarfile/issues/44)\]
- New `RarInfo.is_file` and `RarInfo.is_symlink` methods. Only one of `~RarInfo.is_file`, `~RarInfo.is_dir` or `~RarInfo.is_symlink` can be True.
- `RarFile.printdir` has `file` argument for output.
- `RarFile.__iter__` loops over `RarInfo` entries.
- RAR3: throw `NeedFirstVolume` exception with current volume number, like RAR5 does. \[[\58](https://github.com/markokr/rarfile/issues/58)\]
- Nanosecond timestamp support. Visible as `nsdatetime` instance.
- Minimal CLI when run as script: `python3 -m rarfile`
- Skip old file versions in versioned archive.

Cleanups:

- Use PBKDF2 implementation from `hashlib`.
- Improve test coverage.

3.3

Fixes:

- Add the .sfx test files to MANIFEST.in for inclusion in pypi tarball. \[[\60](https://github.com/markokr/rarfile/issues/60)\]
- Add all files in git to tarball.

3.2

New features:

- Support `unar` as decompression backend. It has much better support for RAR features than `bsdtar`. \[[\36](https://github.com/markokr/rarfile/issues/36)\]
- Support SFX archives - archive header is searched in first 2MB of the file. \[[\48](https://github.com/markokr/rarfile/issues/48)\]
- Add `HACK_TMP_DIR` option, to force temp files into specific directory. \[[\43](https://github.com/markokr/rarfile/issues/43)\]

Fixes:

- Always use "/" for path separator in command-line, gives better results on Windows.

Cleanups:

- Drop module-level options from docs, they create confusion. \[[\47](https://github.com/markokr/rarfile/issues/47)\]
- Drop support for Python 2 and 3.5 and earlier. Python 2 is dead and requiring Python 3.6 gives blake2s, stdlib that supports pathlib, and ordered dict without compat hacks.
- Replace PyCrypto with PyCryptodome in tests.
- Use Github Actions for CI.

Links

Releases

Has known vulnerabilities

© 2024 Safety CLI Cybersecurity Inc. All Rights Reserved.