Extract everything using Libarchive

Asked

Viewed 35 times

0

How do I extract all content from a compressed file to the current directory? P.S.: The file has folders and files.

import libarchive    
def unpack(file):
        #?
  • what file format? what you tried?

1 answer

1


Try to use 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()

https://pypi.python.org/pypi/pylzma

Browser other questions tagged

You are not signed in. Login or sign up in order to post.