Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documentation "RAR flag bits" & Request for more predefined methods #24

Open
ganego opened this issue Feb 7, 2020 · 1 comment
Open

Comments

@ganego
Copy link

ganego commented Feb 7, 2020

Hi, documentation says "RAR flag bits". That is nice. It would be also nice if the documentation could link to some place where I can see what those flags are. I cannot find information on it. Here you can find "File flags" and they start at 0x0001, yet unrar returns 0 for all files and 32 for a folder. So that cannot be the correct one.

While at it, why does python-unrar not come with predefined methods like is_file, is_folder, is_encrypted ... ?

@Vimos
Copy link

Vimos commented Sep 12, 2022

I also want to ask if there are simple APIs for testing enctryption.

A similar function in zipfile:

            with zipfile.ZipFile(archive_stream) as rd:
                for rf in rd.infolist():
                    is_encrypted = rf.flag_bits & 0x1

The flag_bits can actually offer such information. But using such & bit operation is not safe for users.

Update:

I just came across this API which may solve my problem:

            with rarfile.RarFile(archive_stream) as rd:
                is_encrypted = rd.needs_password()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants