davidlee
davidlee

Reputation: 6167

How to hide a download path of a file with Nodejs and Express

I have a situation where I want to hide the source path or download path of a file in my server from displaying on html. However, user is still be able to download it.

Any plugin for this? It's build with Nodejs and Express.

Upvotes: 0

Views: 905

Answers (1)

crellee
crellee

Reputation: 915

Perhaps you should create an API for it? Then you wont give away your file/folder structure.

router.get('/api/download-file', (req, res) => {
   res.sendFile(your_file, {headers: {'Content-Type': 'your_file_type'}})
})

Upvotes: 2

Related Questions