dsoprea / PyEasyArchive

A very intuitive and useful adapter to libarchive for universal archive access.
MIT License
96 stars 33 forks source link

Is it possible to access files inside an archive nested inside another archive ? #18

Open stuaxo opened 7 years ago

stuaxo commented 7 years ago

E.G. - A zip file containing many 7zips, that themselves have files inside ?

SkyLeach commented 7 years ago
    data = [block for block in entry.blocks]
    for entry2 in  libarchive.public.memory_pour(data):
        if entry2.filetype.IFDIR or dest[-1] == os.path.sep:
            if not os.path.exists(dest):
                os.makedirs(dest)
        else:
            try:
                with open(dest, 'wb') as f:
                    try:
                        for block in entry2.get_blocks():
                            f.write(block)
                    except ValueError:
                        # TODO: add further test when PyEasyArchive is patched
                        _logger.warn('Probable password encrypted file.')