7 lines
220 B
TypeScript
7 lines
220 B
TypeScript
import sharp from "sharp";
|
|
|
|
export async function ensureJpg(avatar: Buffer) {
|
|
const img = await sharp(avatar).toFormat("jpeg").resize(1024, 1024);
|
|
const buf = await img.toBuffer();
|
|
return buf.toString("base64");
|
|
}
|