V
V
vasIvas2015-03-10 23:04:31
Node.js
vasIvas, 2015-03-10 23:04:31

How to download a file using nodejs?

Please explain in words how to download a file from the link domain.com/package/file.extension ?
At least in words.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mikhail Goryachkin, 2015-03-10
@vasIvas

For example like this:

var http = require('http');
var fs = require('fs');

var file = fs.createWriteStream("file.jpg");
var request = http.get("http://test/test.jpg", function(response) {
  response.pipe(file);
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question