mirror of
https://github.com/lovell/sharp.git
synced 2025-12-19 07:15:08 +01:00
Emit post-processing 'info' event for Stream-based output
This commit is contained in:
14
docs/api.md
14
docs/api.md
@@ -27,6 +27,7 @@ The object returned by the constructor implements the
|
||||
[stream.Duplex](http://nodejs.org/api/stream.html#stream_class_stream_duplex) class.
|
||||
|
||||
JPEG, PNG or WebP format image data can be streamed out from this object.
|
||||
When using Stream based output, derived attributes are available from the `info` event.
|
||||
|
||||
```javascript
|
||||
sharp('input.jpg')
|
||||
@@ -37,6 +38,19 @@ sharp('input.jpg')
|
||||
});
|
||||
```
|
||||
|
||||
```javascript
|
||||
// Read image data from readableStream,
|
||||
// resize to 300 pixels wide,
|
||||
// emit an 'info' event with calculated dimensions
|
||||
// and finally write image data to writableStream
|
||||
var transformer = sharp()
|
||||
.resize(300)
|
||||
.on('info', function(info) {
|
||||
console.log('Image height is ' + info.height);
|
||||
});
|
||||
readableStream.pipe(transformer).pipe(writableStream);
|
||||
```
|
||||
|
||||
#### metadata([callback])
|
||||
|
||||
Fast access to image metadata without decoding any compressed image data.
|
||||
|
||||
@@ -10,6 +10,10 @@
|
||||
[#338](https://github.com/lovell/sharp/issues/338)
|
||||
[@lookfirst](https://github.com/lookfirst)
|
||||
|
||||
* Emit post-processing 'info' event for Stream output.
|
||||
[#367](https://github.com/lovell/sharp/issues/367)
|
||||
[@salzhrani](https://github.com/salzhrani)
|
||||
|
||||
### v0.13 - "*mind*"
|
||||
|
||||
#### v0.13.1 - 27<sup>th</sup> February 2016
|
||||
|
||||
Reference in New Issue
Block a user