{"size": 869, "ext": "js", "max_stars_repo_path": "tools/getPics/getPhotos.js", "max_stars_repo_name": "derrumbe/Spartacus-as-a-Service", "max_stars_repo_stars_event_min_datetime": "2019-05-24T01:22:02.000Z", "max_stars_repo_stars_event_max_datetime": "2021-04-23T11:38:27.000Z", "max_issues_repo_path": "tools/getPics/getPhotos.js", "max_issues_repo_name": "derrumbe/Spartacus-as-a-Service", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tools/getPics/getPhotos.js", "max_forks_repo_name": "derrumbe/Spartacus-as-a-Service", "max_forks_repo_forks_event_min_datetime": "2021-01-22T21:21:02.000Z", "max_forks_repo_forks_event_max_datetime": "2021-01-22T21:21:02.000Z"}
{"max_stars_count": 16, "max_issues_count": null, "max_forks_count": 1, "avg_line_length": 19.3111111111, "max_line_length": 97, "alphanum_fraction": 0.5949367089}
var fs = require('fs'),
    request = require('request');

var temporal = require("temporal");






    var download = function (uri, filename, callback) {
      //  sleep(1000*i);
        request.head(uri, function (err, res, body) {
            console.log('content-type:', res.headers['content-type']);
            console.log('content-length:', res.headers['content-length']);

            request(uri).pipe(fs.createWriteStream(filename)).on('close', callback);
        });
    };


// Loop every n milliseconds, executing a task each time
temporal.loop(10000, function() {

    console.log("Every 500ms...");








    download('https://thispersondoesnotexist.com/image', 'face'+this.called+'.jpg', function () {
        console.log('done');
    });


    // The number of times this loop has been executed:
    if (this.called==50)
        this.stop();


});
