mirror of
https://github.com/lovell/sharp.git
synced 2025-12-06 03:51:40 +01:00
29 lines
992 B
JavaScript
29 lines
992 B
JavaScript
/*!
|
|
Copyright 2013 Lovell Fuller and others.
|
|
SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
const { describe, it } = require('node:test');
|
|
const assert = require('node:assert');
|
|
|
|
const sharp = require('../../');
|
|
const fixtures = require('../fixtures');
|
|
|
|
describe('toBuffer', () => {
|
|
it('reusing same sharp object does not reset previously passed parameters to toBuffer', async () => {
|
|
const image = sharp(fixtures.inputJpg);
|
|
const obj = await image.toBuffer({ resolveWithObject: true });
|
|
assert.strictEqual(typeof obj, 'object');
|
|
assert.strictEqual(typeof obj.info, 'object');
|
|
assert.strictEqual(Buffer.isBuffer(obj.data), true);
|
|
const data = await image.toBuffer();
|
|
assert.strictEqual(Buffer.isBuffer(data), true);
|
|
});
|
|
|
|
it('correctly process animated webp with height > 16383', async () => {
|
|
const data = await sharp(fixtures.inputWebPAnimatedBigHeight, { animated: true })
|
|
.toBuffer();
|
|
assert.strictEqual(Buffer.isBuffer(data), true);
|
|
});
|
|
});
|