这个sharp到底怎么用的啊,为什么这样子会返回一串乱码
```js
const server = http.createServer(async (req, res) => {
// 调用 updateuserId 函数
await updateuserId();
await new Sharp({
create: {
width: 200,
height: 100,
channels: 3,
background: { r: 255, g: 255, b: 255 }
},
text: {
width: 200,
height: 100,
font: 'sans',
text: ${userId}
}
})
.png()
.toBuffer()
.then(imageBuffer => {
// 设置响应头
res.writeHead(200, { 'Content-Type': 'image/png' });
// 返回图片
res.end(imageBuffer);
})
});
// 服务器监听 6541 端口
server.listen(6541, () => {
console.log('Server is running on http://localhost:6541');
});
```
~~
0
2

还在为IP不纯、平台风控、频繁验证而烦恼? 丽萨主机海外原生IP VPS,双ISP住宅IP,覆盖美国、香港、日本、新加坡、台湾、德国、越南、英国等热门地区,适合跨境电商、社媒运营、AI工具、流媒体及海外业务使用。
2 การตอบกลับ
การเรียงลำดับ