Add Media Type to metadata response #4492

This commit is contained in:
Lovell Fuller
2026-02-01 21:20:16 +00:00
parent 2291c0b864
commit 6d18c6fdc6
8 changed files with 93 additions and 5 deletions

View File

@@ -36,6 +36,7 @@ describe('AVIF', () => {
density: 72,
depth: 'uchar',
format: 'jpeg',
mediaType: 'image/jpeg',
hasAlpha: false,
hasProfile: false,
// 32 / (2048 / 858) = 13.40625
@@ -64,6 +65,7 @@ describe('AVIF', () => {
compression: 'av1',
depth: 'uchar',
format: 'heif',
mediaType: 'image/avif',
hasAlpha: false,
hasProfile: false,
height: 26,
@@ -93,6 +95,7 @@ describe('AVIF', () => {
compression: 'av1',
depth: 'uchar',
format: 'heif',
mediaType: 'image/avif',
hasAlpha: false,
hasProfile: false,
height: 24,
@@ -119,6 +122,7 @@ describe('AVIF', () => {
compression: 'av1',
depth: 'uchar',
format: 'heif',
mediaType: 'image/avif',
hasAlpha: false,
hasProfile: false,
height: 13,
@@ -148,6 +152,7 @@ describe('AVIF', () => {
compression: 'av1',
depth: 'uchar',
format: 'heif',
mediaType: 'image/avif',
hasAlpha: true,
hasProfile: false,
height: 300,
@@ -178,6 +183,7 @@ describe('AVIF', () => {
compression: 'av1',
depth: 'uchar',
format: 'heif',
mediaType: 'image/avif',
hasAlpha: false,
hasProfile: false,
height: 26,
@@ -236,6 +242,7 @@ describe('AVIF', () => {
void exif;
assert.deepStrictEqual(metadata, {
format: 'heif',
mediaType: 'image/avif',
width: 4096,
height: 800,
space: 'srgb',
@@ -259,6 +266,7 @@ describe('AVIF', () => {
const { size, ...pngMetadata } = await sharp(data).metadata();
assert.deepStrictEqual(pngMetadata, {
format: 'png',
mediaType: 'image/png',
width: 4096,
height: 800,
space: 'srgb',