watwatwat

Untitled

Oct 23rd, 2017
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const http = require('http');
  2.  
  3. http.get('http://www.brainstation.io', function(response){
  4.    
  5. let body = ''; 
  6.    
  7. response.on('data', function(chunk){
  8.         console.log('Body: ' + chunk)  
  9.         // re-assemble the chunk
  10.         body += chunk; 
  11.     });
  12.    
  13.     response.on('end',function(){
  14.         console.log('Final Body: ' + body);
  15.     });
  16. });
Add Comment
Please, Sign In to add comment