Home > database >  Download file using curl in Nodejs
Download file using curl in Nodejs

Time:09-17

I'm trying to download a file using and API endpoint. The following command works in CMD:
curl http://localhost:8042/endpoint/file > file.extension

How can I include this command in NodeJS? I've tried using node-libcurl but I can't set the name of the file. Any ideas?

CodePudding user response:

@Lawrence Cherone This works amazingly.
require("child_process").exec("curl ... > file.extension")

  • Related