Class: Warc::CLI

Inherits:
Thor
  • Object
show all
Defined in:
lib/warc/cli.rb

Instance Method Summary collapse

Instance Method Details

#dump(path) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/warc/cli.rb', line 9

def dump(path)
  w=Warc.open_stream(path)
  puts "WARC filename\toffset\twarc-type\twarc-target-uri\twarc-record-id\tcontent-type\tcontent-length"
  w.each(options[:offset]) do |record|
    puts "#{path}\t#{record.offset}\t#{record.header['warc-type']}\t#{record.header['warc-target-uri']}\t#{record.header['warc-record-id']}\t#{record.header['content-type']}\t#{record.header.content_length}"
  end
end

#replay(warc) ⇒ Object



19
20
21
# File 'lib/warc/cli.rb', line 19

def replay(warc)
  Warc::Proxy::Replay.start(warc,options[:p])
end