does anybody else think this (or something similar) would be a useful
extension to zlib?
Conveniently process a number of files that may
be a mixture of gzip compressed and uncompressed
ARGFZ = Class.new do
::ARGV.each do |arg|
if arg == “-”
io = ::Zlib::GzipReader.open(arg) rescue ::File.open(arg)
addional methods for gets etc. could be added
but seeking is too hard to be possible
Example usage, file catz.rb:
require ‘zliba’ # this would be ‘zlib’ once this is integrated
ARGFZ.each do |line|
Then on shell prompt:
catz.rb foo foo.gz
Will print all lines from foo and then from foo.gz.