Method: Warc.open_stream
- Defined in:
- lib/warc/stream.rb
.open_stream(path, mode = 'r+') ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/warc/stream.rb', line 4 def self.open_stream(path,mode='r+') gzipped = path.match(/.*\.warc\.gz$/) warc = path.match(/.*\.warc$/) if (gzipped || warc) fh = ::File.exists?(path) ? ::File.new(path,mode) : path return Stream::Gzip.new(fh) if gzipped return Stream::Plain.new(fh) if warc else return Stream::Gzip.new(path) end end |