Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

20
  • 5
    I got the following console output when I ran this script: node.js:201 throw e; // process.nextTick error, or 'error' event on first tick ^ Error: connect ECONNREFUSED at errnoException (net.js:646:11) at Object.afterConnect [as oncomplete] (net.js:637:18) . Commented Jan 1, 2013 at 6:15
  • 19
    Does this code close the file properly when the script ends or would it lose data? Commented May 20, 2015 at 19:29
  • 2
    @quantumpotato Take a look at the response you're getting back from your request Commented May 8, 2018 at 18:30
  • 15
    This depends upon the req url type if you are requesting https you must use https otherwise it will throw error. Commented Sep 19, 2018 at 13:20
  • 8
    @EthanKeiley why do you say that it isn't closed properly? By default createWriteStream will set autoClose to true and readable.pipe will call end() on the writeable when the readable ends. Commented Jan 28, 2021 at 20:34