RAR Format

RAR Format

Support for the RAR archive format.

The support includes encrypted archives.

The RAR Format package is exposed to the SDK:

from Pro.Core import *
from Pkg.RAR import *

def parseRARArchive(fname):
    c = createContainerFromFile(fname)
    if c.isNull():
        return
    obj = RARObject()
    if not obj.Load(c) or not obj.ParseArchive():
        return
    n = obj.GetEntryCount()
    print(n)
    for i in range(n):
        entry = obj.GetEntry(i)
        if entry == None:
            break
        # skip directories
        if not obj.IsFile(entry):
            continue
        print("file name:", entry.filename)
        # retrieves the file data as NTContainer
        fc = obj.GetEntryData(entry)