title: nodejs write raw image data to jpeg file?
body: <p>I am getting data from a get request. The data (in the body of the response) looks something like this:</p>
  
  <pre><code>... ÿÀ���"�ÿÄ��������������ÿÄ�N��!1"AQa2q¡#BR±ð3brS²ÁÂÑá$ñCDTst¢³&amp;45dÃÒÿÄ������������ÿÄ�-������!1A"Qa¡ðq±ÁÑ2áÿÚ���?�û." """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """ """R1º#ª¥7Jíî½M6îNö ]·!]=Fv­ß`7~qÆee²%·JokkZüCbìþ&lt;ù{ã9öùË®´(%A,Ià�2I?t×bn6wÆù¥V 2SÀ&gt;&lt;k5ºÙØ92EhÎçü¨/aÝ!ã|ñþ¥ñßT}U«¦ÒÚµ«xuÕfÆ³ KØ {ù{ð$·DúBMZÆcp}´R|Mä2ó8üg)·ùôfõ$zXiRÞü}óÆ&gt;,êÚûíR5ý:\ .....
  </code></pre>
  
  <p>the response headers look like this:</p>
  
  <pre><code>HTTP/1.1 200 OK
  Content-Length: 26965
  Access-Control-Allow-Origin: *
  Content-Type: image/jpeg; charset=UTF-8
  Date: Mon, 06 Feb 2012 21:14:21 GMT
  Expires: Mon, 06 Feb 2012 22:14:21 GMT
  Cache-Control: public, max-age=3600
  Last-Modified: Fri, 13 Feb 2009 23:31:30 GMT
  X-Content-Type-Options: nosniff
  X-XSS-Protection: 1; mode=block
  Server: Dropta Server 1.0
  X-Frame-Options: SAMEORIGIN
  Connection: close
  </code></pre>
  
  <p>I want to get the body content which is my image data and save it to a <code>name.jpeg</code> file on the server.</p>
  
  <p>How can I do that? I tried using buffers combined with the <code>fs</code> module, but I am kind of lost.</p>
  
  <p>Thanks</p>