Extract everything using Libarchive

0

How do I extract all the contents of a compressed file into the current directory? P.S .: The file has folders and files.

import libarchive    
def unpack(file):
        #?
    
asked by anonymous 27.11.2014 / 11:59

1 answer

1

Try using PyLZMA:

import pylzma
i = open(compressed_file, 'rb')
o = open(decompressed_file, 'wb')
s = pylzma.decompressobj()
while True:
    tmp = i.read(1)
    if not tmp: break
    o.write(s.decompress(tmp))
o.close()
i.close()

link

    
03.12.2014 / 12:24