Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
136 views
in Technique[技术] by (71.8m points)

javascript - How do I send a jdenticon without storing it on the server using express.js?

What I'm trying to do is create a small API to generate jdenticons and deliver them as pngs. They shouldn't be stored on the server. My code


app.get("/api/avatar/:name", (req, res) => {
  let img=jdenticon.toPng(req.params.name, (isset(req.query.size)?req.query.size:64));
    res.sendFile(img);


});

gives an error because img isn't a path. So how do I convert the Jdenticon to a file and send it?

question from:https://stackoverflow.com/questions/65952006/how-do-i-send-a-jdenticon-without-storing-it-on-the-server-using-express-js

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...