Add usage example of Stream error handling #182

This commit is contained in:
Lovell Fuller 2015-03-24 10:35:05 +00:00
parent 81c710eaa3
commit bd96a49de6

View File

@ -116,9 +116,14 @@ sharp('input.jpg').resize(300, 200).toFile('output.jpg', function(err) {
```
```javascript
var transformer = sharp().resize(300, 200).crop(sharp.gravity.north);
readableStream.pipe(transformer).pipe(writableStream);
var transformer = sharp()
.resize(300, 200)
.crop(sharp.gravity.north)
.on('error', function(err) {
console.log(err);
});
// Read image data from readableStream, resize and write image data to writableStream
readableStream.pipe(transformer).pipe(writableStream);
```
```javascript