I want to download directly when I open a link. By default, opening a link will automatically open a preview in the browser. Can nodejs add header to the url before opening the link?
exports.download = async (ctx,next) => {
ctx.type = "application/octet-stream"
ctx.set("Content-Disposition","attachment;filename=name")//
ctx.redirect(ctx.request.query.path) //
}
I am currently using redirects without adding this header.
if I write this url in a route in iframe form, what I download is the code for the iframe tag.