MCPcopy Create free account
hub / github.com/CommE2E/comm / initializeSharp

Function initializeSharp

keyserver/src/uploads/media-utils.js:20–32  ·  view source on GitHub ↗
(buffer: Buffer, mime: string)

Source from the content-addressed store, hash-verified

18import type { UploadInput } from '../creators/upload-creator.js';
19
20function 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
34function getMediaType(inputMimeType: string): 'photo' | 'video' | null {
35 if (!serverCanHandleTypes.has(inputMimeType)) {

Callers 1

convertImageFunction · 0.85

Calls 1

decodeMethod · 0.80

Tested by

no test coverage detected