mirror of
https://github.com/lovell/sharp.git
synced 2025-07-10 02:50:15 +02:00
Allow use of failOnError with Stream-based input #1691
This commit is contained in:
parent
631a3597c7
commit
628996846d
@ -9,7 +9,10 @@ Requires libvips v8.8.0.
|
||||
* Remove `overlayWith` previously deprecated in v0.22.0.
|
||||
|
||||
* Drop support for Node.js versions 6 and 11.
|
||||
[#1212](https://github.com/lovell/sharp/issues/1674)
|
||||
[#1674](https://github.com/lovell/sharp/issues/1674)
|
||||
|
||||
* Allow use of failOnError option with Stream-based input.
|
||||
[#1691](https://github.com/lovell/sharp/issues/1691)
|
||||
|
||||
### v0.22 - "*uptake*"
|
||||
|
||||
|
@ -19,7 +19,7 @@ function _createInputDescriptor (input, inputOptions, containerOptions) {
|
||||
} else if (is.plainObject(input) && !is.defined(inputOptions)) {
|
||||
// Plain Object descriptor, e.g. create
|
||||
inputOptions = input;
|
||||
if (is.plainObject(inputOptions.raw)) {
|
||||
if (is.plainObject(inputOptions.raw) || is.bool(inputOptions.failOnError)) {
|
||||
// Raw Stream
|
||||
inputDescriptor.buffer = [];
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('assert');
|
||||
const fs = require('fs');
|
||||
|
||||
const sharp = require('../../');
|
||||
const fixtures = require('../fixtures');
|
||||
@ -72,4 +73,10 @@ describe('failOnError', function () {
|
||||
done(err.message.includes('VipsJpeg: Premature end of JPEG file') ? undefined : err);
|
||||
});
|
||||
});
|
||||
|
||||
it('handles stream-based input', function () {
|
||||
const writable = sharp({ failOnError: false });
|
||||
fs.createReadStream(fixtures.inputJpgTruncated).pipe(writable);
|
||||
return writable.toBuffer();
|
||||
});
|
||||
});
|
||||
|
Loading…
x
Reference in New Issue
Block a user