Add support for Buffer and Stream-based TIFF output

This commit is contained in:
Lovell Fuller
2017-05-04 16:40:49 +01:00
parent 19dd6a997f
commit c8e59f08ec
7 changed files with 42 additions and 6 deletions

View File

@@ -837,6 +837,20 @@ describe('Input/output', function () {
});
});
it('Save TIFF to Buffer', function (done) {
sharp(fixtures.inputTiff)
.resize(320, 240)
.toBuffer(function (err, data, info) {
if (err) throw err;
assert.strictEqual(true, data.length > 0);
assert.strictEqual(data.length, info.size);
assert.strictEqual('tiff', info.format);
assert.strictEqual(320, info.width);
assert.strictEqual(240, info.height);
done();
});
});
it('Invalid WebP quality throws error', function () {
assert.throws(function () {
sharp().webp({ quality: 101 });
@@ -914,7 +928,7 @@ describe('Input/output', function () {
});
});
it('TIFF deflate compression with hoizontal predictor shrinks test file', function (done) {
it('TIFF deflate compression with horizontal predictor shrinks test file', function (done) {
const startSize = fs.statSync(fixtures.inputTiffUncompressed).size;
sharp(fixtures.inputTiffUncompressed)
.tiff({