I am getting data from a get request. The data (in the body of the response) looks something like this:
... ÿÀ���\"�ÿÄ��������������ÿÄ�N��!1\"AQa2q¡#BR±ð3brS²ÁÂÑ
A slightly shorter version, which uses Stream.pipe:
var http = require('http'), fs = require('fs'), imgSource = 'http://upload.wikimedia.org/wikipedia/commons/1/15/Jagdschloss_Granitz_4.jpg'; http.get(imgSource, function(res) { res.pipe(fs.createWriteStream('wiki.jpg')); });