node-js-libs/curlrequest

Downloading ascii vs binary files?

Closed this issue · 1 comments

When you use curl on the command line, you can do the following to download a file and save it locally:

curl 'https://example/file.txt' > file.txt

or

curl 'https://example/image.jpg' > image.jpg

You don't have to worry about whether the file is ASCII or Binary. It just works.

So with curlrequest, the data you get in your callback in a file buffer. You don't know if it's binary or ascii and have to figure that out in order to write it locally. Is it possible to specify an outfile so that curl will just write the file without having to worry about it like on the command line?

Nevermind, just used the curl 'output' argument.