This could seriously increase the power of Stream-based image processing.
Here's an example of how halving an image's dimensions could work:
// PROPOSED API NOT YET AVAILABLE
var halver = sharp().before(function(metadata) {
this.resize(metadata.width / 2, metadata.height / 2);
});
readableStream.pipe(halver).pipe(writableStream);
// PROPOSED API NOT YET AVAILABLE
The existing metadata logic can also be improved to require only the first few hundred bytes of a Stream.
In addition, adding a "playbook" of example uses for this feature to the docs would be great too. There's a variable/percentage extract/crop under discussion at #205 that this should allow for.