# >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>><<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
-require 'zlib'
+# require 'zlib'
# require 'bzip2'
require 'open3'
if mode == 'w'
case options[:compress]
when :gzip
- ios = Zlib::GzipWriter.new File.open(file, mode, options)
+ # ios = Zlib::GzipWriter.new File.open(file, mode, options)
+ ios, = Open3.pipeline_w("gzip -f", out: file)
when :bzip, :bzip2
# ios = Bzip2::Writer.new File.open(file, mode, options) # TODO being pissed with buggy bzip2 gem.
ios, = Open3.pipeline_w("bzip2 -c", out: file)
else
case `file -L #{file}`
when /gzip/
- ios = Zlib::GzipReader.new File.open(file, mode, options)
+ # ios = Zlib::GzipReader.new File.open(file, mode, options)
+ ios = IO.popen("zcat #{file}")
when /bzip/
# ios = Bzip2::Reader.new File.open(file, mode, options) # TODO this method is buggy, investigate
ios = IO.popen("bzcat #{file}")