sharp/test/unit/toBuffer.js
Lovell Fuller b36237ddcb Switch linter from semistandard to biome
Uses the recommended rules apart from complexity/useArrowFunction,
which would affect about 1700 lines of code with little benefit
right now. This is something that can be addressed over time.
2025-09-18 21:18:31 +01:00

26 lines
940 B
JavaScript

// Copyright 2013 Lovell Fuller and others.
// SPDX-License-Identifier: Apache-2.0
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);
});
});