Created
October 19, 2012 20:12
-
-
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.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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