/
githubmirror
/
next.js
Обзор
Документация
Войти
/
githubmirror
/
next.js
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
canary
test/production/sharp-api/pages/api/custom-sharp.js
12 строк
395 B
Tim Neutkens
Convert test/integration to isolated tests (#93247)
11 май 2026, 14:55
Не верифицирован
11 май 2026, 14:55
8141dcf
Код
Авторство
О чём код?
import sharp from 'sharp' export default async function handler(req, res) { const roundedCorners = Buffer.from( '<svg><rect x="0" y="0" width="200" height="200" rx="50" ry="50"/></svg>' ) const buffer = await sharp(roundedCorners).resize(200, 200).png().toBuffer() res.setHeader('content-type', 'image/png') res.setHeader('content-length', buffer.byteLength) res.end(buffer) }