Thursday 4 May 2017

Save HTMLLog to file via NodeJS

I have a function that unfortunately does not work.

function functionName(filename) {

  fs.open(filename+'out', "w+", 0644, function(err, file_handle) {
    alert('File load');
  });
  stream = fs.createWriteStream(filename+'out');
  var proxyChecker = require('proxy-checker');

proxyChecker.checkProxiesFromFile(
    filename,
    {
        url: 'https://www.google.ru/',
        regex: /test/
    },
    // Callback function to be called after the check
  function(host, port, ok, statusCode, err) {
        console.log(host + ':' + port + ' => '
            + ok + ' (status: ' + statusCode + ', err: ' + err + ')');
    })
    }
);
}
}

What proxy checker such and so and so? I Use this https://github.com/scastiel/node-proxy-checker

But my code is not executed. Writes a simple mistake. Check the correctness of the code. Thank you.

By itself this code works but it only writes to the console. And I need it saved in a file that I specify in the name "filename"

    var proxyChecker = require('proxy-checker');

proxyChecker.checkProxiesFromFile(
    // The path to the file containing proxies
    filename,
    {
        url: 'http://google.com',
        regex: /test/
    },
    // Callback function to be called after the check
    function(host, port, ok, statusCode, err) {
        console.log(host + ':' + port + ' => '
            + ok + ' (status: ' + statusCode + ', err: ' + err + ')');
    }
);

and look on this https://pastebin.com/raw/fFXtCuDL



via Lite Support

No comments:

Post a Comment