in reply to seek() functionality on pipes

It's not seek for pipes in general, but if all you want is seek for gunzip, check out IO::Uncompress::AnyInflate's documentation, which is part of IO-Compress-zLib.

At a quick search.cpan.org glance, it seems to do what you want, although I'm not sure how efficient seeking is as compared to just reading and throwing away n bytes. It's very unlikely to be worse, and might just be a lot better if there's a way to skip some uncompressing by reading metadata, so it's worth a try...


Mike

Replies are listed 'Best First'.
Re^2: seek() functionality on pipes
by HKS (Acolyte) on Jul 21, 2008 at 19:02 UTC
    I chose not to go with the Perl decompression libraries because I want to allow for multiple formats (bzip2, gzip, zip, etc) without a whole lot of extra code.
      Reasonable. Although note that IO::Uncompress::AnyInflate supports zip and gzip, so you might be able to use that for those formats if it seeks faster, and fall back to a pipe/pseek solution for bzip2.

      Mike