Skip to content

Instantly share code, notes, and snippets.

@kig
Created May 20, 2010 14:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kig/407595 to your computer and use it in GitHub Desktop.
Save kig/407595 to your computer and use it in GitHub Desktop.
#!/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