Create a gist now

Instantly share code, notes, and snippets.

#!/usr/bin/ruby
require 'json'
files = []
offset = 0
ARGV.map{|fn|
fsz = File.size(fn)
files << {'filename'=> fn, 'offset'=> offset, 'length'=> fsz}
offset += fsz
}
puts files.to_json
ARGV.each{|fn|
File.open(fn,'rb'){|f|
STDOUT.write f.read(4096) until f.eof?
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment