Skip to main content

Download the image

When the Download button is clicked, instead of invoking an API, we perform a redirect to a URL. This URL is constructed using the Node-RED link and the path to the desired endpoint (the URL value specified in the "http in" node). The image link is passed as a query parameter.

Please refer to the provided JavaScript code snippet for implementation details.

{{navigateTo('https://flowbuilder-63f7220ca0ac091200000096.ubos.tech/download',{url: currentItem.img},'NEW_WINDOW')}}

image.png

or fill in the fields

image.png

Additionally, need to create another endpoint for image upload.

image.png

For this, we use the following nodes:

  • http in
  • function 
msg.url = msg.req.originalUrl.replace("/download?url=", '')
return msg;
  • http request

image.png

  • function 
msg.headers = { "Content-Disposition": "attachment;filename=filename.png", 'Content-Type': 'image/png' }

return msg;
  • http response