UNPKG

tgram.js

Version:

Lightweight modern library for telegram bot. use Node.js

12 lines (11 loc) 339 B
import sharp from "sharp"; import telegramFetch from "./telegram-fetch.js"; export async function convertToWebp(url) { const buffer = await telegramFetch.get(url, { responseType: "arraybuffer" }) const webp = await sharp(buffer.data).resize(512, 512, { fit: "inside" }).webp().toBuffer(); return webp }