Advertisement
Guest User

async http callbacks

a guest
Mar 22nd, 2019
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var http = require('http')
  2. var bl = require('bl');
  3.  
  4.  
  5. function funcName(dir){
  6.  
  7. http.get(dir, function (response){
  8.  
  9.    response.pipe(bl(function (err, data){
  10.  
  11.  
  12.  
  13.        if (err){
  14.    console.error(err)
  15. }
  16.     var realdata = data.toString();
  17.     console.log(realdata)
  18.  
  19.  
  20. }))})
  21. }
  22.  
  23. funcName(process.argv[2]);
  24. funcName(process.argv[3]);
  25. function(process.argv[4]);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement