Friday 22 December 2017

Download a file with Node?

I am relatively new to Node and had a conceptual question.I will have an application generating a file (e.g. an HTML file) -- that application may be another Node app, or a PHP app running on Apache, or what have you. It will likely run on the same server as this second application I am wanting to make, but it may be on a different server just for extensibility purposes. I want to get the contents of that generated file, e.g. file_get_contents('localhost:8010/generated-file.php') or file_get_contents('some-other-domain.com/'). How would one go about doing this efficiently? I was looking into reading files with fs, but it only supports file://, not connections of HTTP.Is there a standard or optimal way of doing this? Is there a better way to do it for calls specifically to localhost than over the internet?Thanks for any help.

Submitted December 22, 2017 at 10:04PM by throw_at_work_away

No comments:

Post a Comment