fix: import type of sharp

Signed-off-by: Innei <i@innei.in>
This commit is contained in:
Innei
2024-08-16 15:51:31 +08:00
parent 8a08072534
commit 32954a709d
3 changed files with 6 additions and 6 deletions

View File

@@ -66,7 +66,7 @@ app.register(fastifyCookie, {
const logWarn = (desc: string, req: FastifyRequest, _context: string) => {
const ua = req.raw.headers['user-agent']
Logger.warn(
Logger.log(
// prettier-ignore
`${desc}\n` +
`Path: ${req.url}\n` +

View File

@@ -40,7 +40,7 @@ async function main() {
}
logger.debug('encrypt key: ', ENCRYPT.key)
logger.warn(
logger.log(
`Encrypt is enabled, please remember encrypt key. Your key is starts with ${ENCRYPT.key.slice(
0,
3,

View File

@@ -1,6 +1,6 @@
import { encode } from 'blurhash'
import sharpTypes from 'sharp'
import type { ImageModel } from '~/shared/model/image.model'
import type { Sharp } from 'sharp'
import { Injectable, Logger } from '@nestjs/common'
@@ -119,8 +119,8 @@ export class ImageService {
const imageType = headers['content-type']!
const buffer = Buffer.from(data)
const sharp = (await requireDepsWithInstall('sharp')) as typeof sharpTypes
const sharped = sharp(buffer)
const sharp = await requireDepsWithInstall('sharp')
const sharped = sharp(buffer) as Sharp
const metadata = await sharped.metadata()
const size = {
height: metadata.height,
@@ -139,7 +139,7 @@ export class ImageService {
}
}
const encodeImageToBlurhash = (sharped: sharpTypes.Sharp) =>
const encodeImageToBlurhash = (sharped: Sharp) =>
new Promise<string>((resolve, reject) => {
sharped
.raw()