Skip to content

Instantly share code, notes, and snippets.

@deckchairhq
Created October 19, 2012 20:12
Show Gist options
  • Save deckchairhq/3920411 to your computer and use it in GitHub Desktop.
Save deckchairhq/3920411 to your computer and use it in GitHub Desktop.
Pipe in-to and out-of exiftool - no IO latency. Will add to a fork of mini_exiftool gem.
command = "exiftool -a -m -json -"
puts command.inspect
origin = Deckchair::Tempobject.new()
result = Deckchair::Tempobject.new()
origin.write File.read('./test.pdf')
IO.popen(command, 'rb+') do |pipe|
pipe.puts origin.reread
pipe.close_write
while part = pipe.read(1024)
result << part
end
end
j = JSON.parse( result.reread )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment