Advertisement
rowntreerob

Node fetch url as stream

Nov 15th, 2021
1,029
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. app.get('/files/:from/:to',  function(req, resp, next) {
  2.   var url1, url2 = "";
  3.   if (req.params.from)url1 = decodeURI(req.params.from);
  4.   if (req.params.to)url2 = decodeURI(req.params.to);
  5.   fetch(url1)
  6.     .then(response => {
  7.       return response.body;  //instance cls=ReadStream
  8.     })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement