[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multithreaded compression/decompression library with python bindings?

Op 2017-10-04, Paul Moore schreef <p.f.moore at gmail.com>:
> On 4 October 2017 at 16:08, Steve D'Aprano <steve+python at pearwood.info> wrote:
>> On Wed, 4 Oct 2017 08:19 pm, Thomas Nyberg wrote:
>>> Hello,
>>> I was wondering if anyone here knew of any python libraries with
>>> interfaces similar to the bzip2 module which is also multithreaded in
>>> (de)compression? Something along the lines of (say) the pbip2 program
>>> but with bindings for python?

In a pinch:

  with open("myoutfile.gz", "wb") as f:
      sp = subprocess.Popen(("gzip",), stdin=subprocess.PIPE, stdout=f)
      sp.stdin.write(b"Hello, world\n")

Does compression in a separate process ;-)