Read RAR file from python -- cffi edition
Project description
unrar2-cffi -- Work with RAR files.
Description
unrar2-cffi is a python extension that exposes unrar library
functionality through a zipfile
-like interface.
This is a fork/modified version of unrar-cffi that supports modern Python starting from 3.9+
This build also target unrar 7.x instead of unrar 5.x from the original unrar-cffi project.
Difference
This packages has some difference to the original one:
- Added typing information
- Added
__slots__
to improve performance a bit. - Moved all the
RarInfo
into at-property data- Now you can access the raw header data by using
file._header
- Now you can access the raw header data by using
- Added docstring to most functions.
- Implement
RarFile.printdir()
Features
The package implements the following RarFile
functions:
namelist()
infolist()
getinfo()
read()
open()
testrar()
rarfile.is_rar_file()
Usage
-
Install with PIP:
pip install unrar2-cffi
-
Use from code:
from unrar.cffi import rarfile
rar = rarfile.RarFile('sample.rar')
assert rar.testrar() == None
for filename in rar.namelist():
info = rar.getinfo(filename)
print("Reading {}, {}, {} bytes ({} bytes compressed)".format(info.filename, info.date_time, info.file_size, info.compress_size))
data = rar.read(filename)
print("\t{}...\n".format(data[:100]))
Build
Requirements
Linux/macOS:
- gcc compiler suite (
build-essential
packages should be enough) - docker (only for
buildmanylinux
)
Windows:
- VS2022 Build Tools (PLATFORM_TOOLSET=v143)
- Visual C++ compiler suite
vswhere
Compile and test
./build.sh init
./build.sh build
./build.sh test
If you have docker installed, you can build all the manylinux wheels:
./build.sh within [manylinux docker image] buildmanylinux
./build.sh within [manylinux docker image] testmanylinux
By deafult the image quay.io/pypa/manylinux2010_x86_64
will be used.
Use $DOCKER_IMAGE
and $PLAT
variables to customize the build.
Problems
Windows:
- If you need to retarget solution, apply the
0001-build-retarget-to-vs2022-10.0-v143.patch
that will utilize the latest version.
macOS:
- The macOS version are monkeypatching unrar 6.x makefile to utilize C++11
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for unrar2_cffi-0.4.0-cp313-cp313-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20daf5da98a75c9909ff715bd9406dea4c773271de67549aeb0b9781fc74025a |
|
MD5 | 5357d2d0fbfc017aae104dd9507c0b5b |
|
BLAKE2b-256 | 1d0861c4f644f0cc11d5fb3ff4ef4693cfbe190196c2fbbf61769c8c3c73784d |
Hashes for unrar2_cffi-0.4.0-cp313-cp313-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cef5356fb3c0876c6ea69e202fe789dc1f6219842cfb7dec02477d92545e4a48 |
|
MD5 | f19840110f849e86b8d2a277b79ac675 |
|
BLAKE2b-256 | 24090eae21d72b0fcb0861ecfe575c21f5d44f1c6e63e17b146b6c93988c884e |
Hashes for unrar2_cffi-0.4.0-cp313-cp313-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec81c740667f8a2ffe898e231447ded10f824d702e3d9728d6584c612fc459ac |
|
MD5 | 074e8d7422eeb84f54f51b9d2c04c154 |
|
BLAKE2b-256 | 5cbb815565985a488f7d5ab3b30aefda98e5ef97923409d3ffad74287a1de465 |
Hashes for unrar2_cffi-0.4.0-cp313-cp313-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9865f10a988f381f1279e61c5e510d2157466b5faf568d2ebcd68562308bac83 |
|
MD5 | 535e6f85101dfde847502ceef7519ef9 |
|
BLAKE2b-256 | b9768b8c1050ee4114792c2cf06e731fd15efbe0daef156cd5d2e5dedb0c6eef |
Hashes for unrar2_cffi-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0c8b8d94ae7e762f676fbb00e70b6691f08458349a527ce0a97cc02f4230ca70 |
|
MD5 | a9615dfa1fc6575c8c3b046761e85547 |
|
BLAKE2b-256 | 66283a6fb79570eaa5b95aac21a919da96e8d3b29e2041dacfbdb2582f9d06be |
Hashes for unrar2_cffi-0.4.0-cp313-cp313-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2063eed96221f5f2a63d229fc2f2ebaeb1fff182811e11b496f7188b1075b17c |
|
MD5 | f5098f6d25a26a3b62017ff272c8b110 |
|
BLAKE2b-256 | 6acac1aa1bdc9447fc661342ab22f800da595f7a9485b9ef3fac578a66c6be26 |
Hashes for unrar2_cffi-0.4.0-cp312-cp312-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0e42164c85c800cb9c735d9a693408ec6af603cdbc1eb9aea06c3c091b28f5e5 |
|
MD5 | be3c1eb7b7de0502cfb63ec1fa14f9c3 |
|
BLAKE2b-256 | 37e3923c8faf99a67478d7b4cc28542d8e155296a9d83ff20b32e1d603629e9c |
Hashes for unrar2_cffi-0.4.0-cp312-cp312-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9de77678e3c16597a227426b7e8062a03f5370743502d510c6f2a72f1aa88bb0 |
|
MD5 | 18ed5b7c5af20d5dd8ed80dae634c266 |
|
BLAKE2b-256 | 28c4708ca5c8533a61084515654ecf8a6bd6c96a217a174787106eeb10b6b5d7 |
Hashes for unrar2_cffi-0.4.0-cp312-cp312-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a12750c0414e4fcb2a7497a9f3969367e106ff07e0e3555f28e1ad12a5709a1 |
|
MD5 | fb1d10208d427a454fdae0afbdf66020 |
|
BLAKE2b-256 | ae50a5677dbb616dda10f32daa9432e33a5f832e02b456842c51ba0837c5ab41 |
Hashes for unrar2_cffi-0.4.0-cp312-cp312-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d3b11322feb1a4ba0ebdcb870df71cf99fb179f4013ddf1f50ef4f4abf168598 |
|
MD5 | 5540b78269c710f0ea4db27081ff45e0 |
|
BLAKE2b-256 | d9c0c65a591ef9cf81a289ccf6450c9c563d9383fc6c8f59a992d4a9ed6e4eb8 |
Hashes for unrar2_cffi-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22eadd4134223ba30b60f17fcbe017f69c2fe4b1c29ffa2eac8abe46c2822e72 |
|
MD5 | 15ac4ef5aa98a65b14bae6b82ece9f56 |
|
BLAKE2b-256 | f33288fffd30c6597e2cf8b18cb084a9a4abd6d8ad4025c467c4faddbad55386 |
Hashes for unrar2_cffi-0.4.0-cp312-cp312-macosx_10_13_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b2e549973904320bbd92cfca5c4814d735c60ee0da14328aff177630e41eb76a |
|
MD5 | d94851176ef10df4de0f7e7d277e856a |
|
BLAKE2b-256 | fd6638c227bb695f5cf9b16c4dd9ea788113536ab5d0ec2fc3eb082ad8e8dc65 |
Hashes for unrar2_cffi-0.4.0-cp311-cp311-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d37188dcbdf7873f728f048d914db12801537d3544322b67302b9c277818c647 |
|
MD5 | bd71e2b2cb82c86c3c87959d3ee2163e |
|
BLAKE2b-256 | 15507fcc6bfbc3c20d578f46f8ef194315593a766b1766b26a04db5b81efa2c3 |
Hashes for unrar2_cffi-0.4.0-cp311-cp311-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b636657fd8e8d52c427359b5e842d516400ad13ad996e86e094c29b44bab3c0 |
|
MD5 | 681d5a8a327d11d84012c9ddfc80149b |
|
BLAKE2b-256 | 8c0a97788e405a4b06fb1a0d7b06d387a995cec1a116255e6f6283f4a1e92f29 |
Hashes for unrar2_cffi-0.4.0-cp311-cp311-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee8f1ecaa0396b3eb66d415b920dfaa1f5a5a92539be27a6d164aa9006242f89 |
|
MD5 | 8cdf2cd05b56b53c979a49556f1b323d |
|
BLAKE2b-256 | 6794fab926b4af5acd21b797280c0be2b083ff6b785d935bfa3ae453d08e86f5 |
Hashes for unrar2_cffi-0.4.0-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b166fc81044daad401706c373cd94b72ca69ae2612c56d6e2bfa939a40a2c2f5 |
|
MD5 | b648a0ff3b76096019df1d931da8b297 |
|
BLAKE2b-256 | 8160c95d027759bc8a30afe739e3cfa6d076104b3f30bb51ff5cc7958c58a587 |
Hashes for unrar2_cffi-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 008db8fbeee81388b0b490e8b46b82397abe6cb7f22dc64cd8adc0bef3ef6e5f |
|
MD5 | a703bc802334ce33e62c18b37caff118 |
|
BLAKE2b-256 | 000e9803b851e0f34a3061f5f3c5c1451af30f89edd15bfd45c92e9d8d5fb272 |
Hashes for unrar2_cffi-0.4.0-cp311-cp311-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2ac7f8e8a694b16d0d3c20742008f268f7441b06731b9cf1ede5b0f7fc0341e6 |
|
MD5 | 84a6be93743f3e2c2f55ba3c070bfa0b |
|
BLAKE2b-256 | 81eb35ad038565145c375d8ee3470c6677eb5e289a8bab675efd8d6125f0410d |
Hashes for unrar2_cffi-0.4.0-cp310-cp310-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e2524c1f6d70fc60431bebb677cce528cfb5f37cfebd7cb7648091301dc3b31 |
|
MD5 | 0cf52d37c89bb6075d836c112d7c2717 |
|
BLAKE2b-256 | 7a861acc9f4c6058873c4ddecba4b082709dc9f5b95fd69bd02b132b2eb98a2a |
Hashes for unrar2_cffi-0.4.0-cp310-cp310-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6e3ccb43dd16f8b651af841549c95fa698d096b2633074dc0bdae08c2a1df34e |
|
MD5 | c81ece4dad8be59da116dcdba761927d |
|
BLAKE2b-256 | f099a18010b98ff4e64f684e9fb6f3ad982cf9dd753334ca2f284e7da72cf366 |
Hashes for unrar2_cffi-0.4.0-cp310-cp310-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb21c431ab6ce085de3e15f61a1e0638ca199868bb71960bc59074eb1224ad63 |
|
MD5 | a84a76bcf27c85a50f0f27a2c01e0299 |
|
BLAKE2b-256 | 8753fcdcf8215e4a541de5581c06513a9202ecfb02438b43725510fb321e8de9 |
Hashes for unrar2_cffi-0.4.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41b641e60a866b644d6f2dabf4b26e992447da58f5f8233cd877e45849def4c7 |
|
MD5 | 41128c8a480040fb3e1455ea831ead56 |
|
BLAKE2b-256 | 1c45253709f6e7b70a844bb92c05eff01d0494a80e1df6132d938a4d2993bc49 |
Hashes for unrar2_cffi-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7616122df95cdb77a6aa97a0553d6f53e6430f6af94662ce1a59577840c38c9e |
|
MD5 | eab5f1289a98438df911b6b0d253702e |
|
BLAKE2b-256 | e3eebb6b7872faa49765f5fb013769d7a353e587dfbafb6f8406ff697c93ee6a |
Hashes for unrar2_cffi-0.4.0-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f27b87b5091e37e6150d91c6deec59dd1b95ab0d970c9bd88c89b9a892e7b30b |
|
MD5 | 4067ad2763d306279406903b700df47b |
|
BLAKE2b-256 | 0c57bc5e3965b8d94a56f95fd3c2f1159932d614790df0da6242c36263de5213 |
Hashes for unrar2_cffi-0.4.0-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b4c1b5ae95d46b5e013a03dcf580d5e45ccec0735e838c3d4caea3c22470509 |
|
MD5 | 0919821453c6058fef2541a5e48aebfa |
|
BLAKE2b-256 | e377b6096f159e806013ab1f47c2ec22ff3cfb7b1981609b845380e7098c4e80 |
Hashes for unrar2_cffi-0.4.0-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03ae1bb7e0df0f705ff4258c21db2051fd12c37fe8bcb2c01d7e9ae5d1baeb8 |
|
MD5 | c8f9f4d39b676af2e4e475eaa982ba64 |
|
BLAKE2b-256 | a71143ea93a162f88094dc3aaffae7214562e255cd61d343205d910eab7625aa |
Hashes for unrar2_cffi-0.4.0-cp39-cp39-musllinux_1_2_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c19fd6f7de7bec02207bb15f17959e074e59cf27fd9e9d92c1d76a554d7b1234 |
|
MD5 | 8645333c315218af524c241e2db70724 |
|
BLAKE2b-256 | 43bd6628b69167114ef36ce58109cc13064968e9b7b9880061e6eea5cc9bab43 |
Hashes for unrar2_cffi-0.4.0-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2fce650ba552d6bcb0d08e18a0fb4ab4e5bc4161caa3bb168b2aa529504c4a49 |
|
MD5 | eb052bfd798522382a77afc040635fe7 |
|
BLAKE2b-256 | 8a3e15325d709edd5c6b352d72aa41450a1dd856c0d70ea6acf09f2d6010c978 |
Hashes for unrar2_cffi-0.4.0-cp39-cp39-macosx_11_0_arm64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 492990b5861c9b7d1fd3cca31621d1214a594e1a278491eb88e55cfca7b7e1b3 |
|
MD5 | 6a2b2ce39c51b3f193159f3eb52328c8 |
|
BLAKE2b-256 | f987507d110d6285484a90cc0698e6139c856821b1e1fcf4fa578e921c1953fe |
Hashes for unrar2_cffi-0.4.0-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 956dd0b7e06f1e619de2a4f57986af715042b92b5424287cef7ae6b842fea829 |
|
MD5 | 633a35c0fd1c4abcf7f4080a3f8299d2 |
|
BLAKE2b-256 | 08148487d59ee5501574ae7c58d0e14aa5ffc20f95bb20dc2f264acea1f903ed |