A
A
Alexey Ivanov2018-03-25 23:17:42
Node.js
Alexey Ivanov, 2018-03-25 23:17:42

How to download a file on node.js?

There is a php page that gives the file for download:

$size=filesize("MyProgram.exe");
header("Content-Type: application/exe");
header("Content-Disposition: attachment; filename=MyProgram.exe");
header("Content-Length: $size");
header("Cache-control: private");

$filename="MyProgram.exe";
$fp =fopen($filename, 'r');
fpassthru($fp);
header("Location: MyProgram.exe");

I need to download it to node.js, but the usual save by link saves the page and not the file
. How to get exactly the file and not the page?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question