Jul 03, 2024

Wiki

Python

Aide

edit SideBar

Search

Rarfile


http://grue.l-t.ee/~marko/src/rarfile/

Lecture des archives rar en Python.

Description

This is Python module for Rar archive reading. The interface is made as zipfile like as possible.

Features:

    * Supports RAR 3.x archives.
    * Supports multi volume archives.
    * Supports Unicode filenames.
    * Handles non-compressed files without outside help.
    * For compressed files uses unrar utility.

Missing features:

    * Password-protected archives.
    * Comment handling. (archive, file)
    * Decompression through unrarlib and/or unrar.dll.
    * extract_with_hack on multi-volume archives

Personally, I have no need for those, so those are postponed indefinitely.

Module contents

is_rarfile(file)

Returns true if file is Rar archive.

class RarFile

RarFile(archive)

    Creates new RarFile instance and reads Rar directory from archive.

namelist()

    Return list of filenames.

infolist()

    Return list of RarInfo items.

getinfo(filename)

    Returns a RarInfo instance for specific file.

read(filename)

    Read file contents.

close(filename)

    Free open resources. Currently it does nothing.

class RarInfo

filename

    File name with relative path. Note that Rar uses "\" as directory separator.

unicode_filename

    If Rar has stored filenames in unicode mode, it has unicode string of filename. Else None.

host_os

    Host OS type.

file_size

    Uncompressed size.

date_time

    Tuple of year, month, day, hour, minute, second.

compress_size

    Compressed size.

compress_type

    Compression method: 0x30 - 0x35.

extract_version

    Minimal Rar version needed for decompressing.

mode

    File attributes. May be either dos-style or unix-style, depending on host_os.

CRC

    CRC-32 of uncompressed file

Page Actions

Recent Changes

Group & Page

Back Links