rarfile v4.0
Main goals are:
- Increased
zipfile
-compatibility, thus also achieving smaller difference between RAR3 and RAR5 archives. - Implement
RarFile.extract
on top ofRarFile.open
instead usingunrar 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]
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 ofRarFile.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, #52]RarInfo.is_dir
is now preferred spelling ofisdir()
. Old method kept as alias. [#44]- New
RarInfo.is_file
andRarInfo.is_symlink
methods. Only one of~RarInfo.is_file
,~RarInfo.is_dir
or~RarInfo.is_symlink
can be True. RarFile.printdir
hasfile
argument for output.RarFile.__iter__
loops overRarInfo
entries.- RAR3: throw
NeedFirstVolume
exception with current volume number, like RAR5 does. [#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.