mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix(api): support sharp 0.35 types
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import sharp from "sharp";
|
||||
import sharp, { type Sharp } from "sharp";
|
||||
|
||||
export type BgOutputFormat = "png" | "webp" | "avif";
|
||||
|
||||
@@ -10,7 +10,7 @@ export const BG_FORMAT_CONTENT_TYPES: Record<BgOutputFormat, string> = {
|
||||
avif: "image/avif",
|
||||
};
|
||||
|
||||
function toOutputFormat(pipeline: sharp.Sharp, format: BgOutputFormat): Promise<Buffer> {
|
||||
function toOutputFormat(pipeline: Sharp, format: BgOutputFormat): Promise<Buffer> {
|
||||
switch (format) {
|
||||
case "webp":
|
||||
return pipeline.webp({ lossless: true }).toBuffer();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import sharp from "sharp";
|
||||
import sharp, { type FormatEnum } from "sharp";
|
||||
|
||||
type SharpFormat = keyof sharp.FormatEnum | "avif";
|
||||
export type SharpFormat = Extract<keyof FormatEnum, string> | "avif";
|
||||
|
||||
export interface OutputFormat {
|
||||
format: SharpFormat;
|
||||
|
||||
Reference in New Issue
Block a user