memory mapped tar file contents

Jean-Paul Calderone exarkun at divmod.com
Wed Nov 12 22:12:20 EST 2008


On Wed, 12 Nov 2008 18:51:38 -0800 (PST), Chris Brooks <cab938 at mail.usask.ca> wrote:
>
>Hi,
>
>I would like to read directly from a tar file into memory so I can
>manipulate a file (quickly) and write its changes out to another file.  I
>thought I could do something like:

If you mmap a tar file, then you'll get a bunch of tar formatted stuff.  If
you mmap a gzipped tar file, then you'll get a bunch of gzipped stuff.  Are
you sure that's what you want?  From your code snippet, it looks more like
you want the uncompressed file data from the archive.  In this case, you
cannot meaningfully use mmap to speed up your application.  The data has
to be uncompressed and interpreted before you can get the application data.

Jean-Paul



More information about the Python-list mailing list