Closed rikonor closed 6 years ago
Hey @lfos, thanks for the review.
I'm sorry but I won't have time to touch this in the next few weeks. If you're open to it, I'm fine with you taking over the PR and making changes as you see fit.
Merged to pu
(with some minor changes). Thanks!
I was having trouble using stdin/stdout for input/output to jpeg-recompress.
Digging a little bit deeper and with the help of @pope I realized that jpeg-recompress actually reads the input multiple times, so by the second read the input is already drained. This is why it works fine with files, but not with pipes/stdin.
The fix adds new
decodeFiletype
anddecodeFile
versions that take a buffer instead of reading the file themselves.