Skip to content

Commit

Permalink
add res.type
Browse files Browse the repository at this point in the history
  • Loading branch information
iiop123 committed Dec 7, 2022
1 parent cce7c80 commit a428efb
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ router.post(
metadata:{
size:img[i].size,
name:url,
type:img[i].type,
date:new Date().getTime()
}
})
Expand All @@ -119,6 +120,8 @@ router.post(
);
router.get('/api/img/:p', async ({req,res})=>{
let body=await LINK.get(req.params.p,{cacheTtl:864000,type:"stream"})
const { metadata } = await LINK.getWithMetadata(req.params.p);
res.type=metadata.type
res.body=body

})
Expand Down Expand Up @@ -148,4 +151,4 @@ router.post(
new Application()
.use(normalizePathnameMiddleware)
.use(router.middleware)
.listen();
.listen();

0 comments on commit a428efb

Please sign in to comment.