0

I have a REST API developed in node js. One of my routes downloads a file and i am able to download the file too. But i am also trying to retain the actual file name when sending across. I have set the appropriate headers too.

My route is

http://localhost/v1/tests/myfile

And I have set the following headers,

{ 

 'Content-Type': 'application/text', 

 'Content-Length': stat.size, 

 'Content-Disposition': 'attachment',

 'filename': 'sample.txt'

}

When I access the route in Chrome or Firefox, the file is downloading as myfile. Why is this happening and how do i retain my file name?

Anu
  • 35
  • 1
  • 6

0 Answers0