http://qs321.pair.com?node_id=111817


in reply to Different compression behaviours with Compress::Zlib

Yes. There is more to a gzipped file than a gzipped data stream. There's also a file header and footer, as you've found out.

If you do the in-memory compression without using gzopen() etc. you will need to do in-memory decompression to read it.

Or you could just write the header and footer yourself.

You might consider trying afio, which is like cpio but can compress individual files. It also knows about tapes. When combined with reasonable buffering (like Kbackup's Multibuf), you won't see any slowdown from its spawning gzip to compress streams.

In general, the answer to streaming tape drives is good buffering; this may be difficult to do in a single Perl process. You may want to put a dual-buffer or buffer-pool program in between your program and the tape. If you use Multibuf, it will also detect end-of-medium conditions and allow you to change tapes so you can have multiple volumes.