(buffer: Buffer, mime: string)
| 18 | import type { UploadInput } from '../creators/upload-creator.js'; |
| 19 | |
| 20 | function initializeSharp(buffer: Buffer, mime: string) { |
| 21 | if (mime !== 'image/bmp') { |
| 22 | return sharp(buffer); |
| 23 | } |
| 24 | const bitmap = bmp.decode(buffer, true); |
| 25 | return sharp(bitmap.data, { |
| 26 | raw: { |
| 27 | width: bitmap.width, |
| 28 | height: bitmap.height, |
| 29 | channels: 4, |
| 30 | }, |
| 31 | }); |
| 32 | } |
| 33 | |
| 34 | function getMediaType(inputMimeType: string): 'photo' | 'video' | null { |
| 35 | if (!serverCanHandleTypes.has(inputMimeType)) { |