{"size": 809, "ext": "js", "max_stars_repo_path": "test/example/node/publish_primus.js", "max_stars_repo_name": "davedoesdev/centro", "max_stars_repo_stars_event_min_datetime": "2017-12-05T13:06:22.000Z", "max_stars_repo_stars_event_max_datetime": "2019-12-29T11:48:04.000Z", "max_issues_repo_path": "test/example/node/publish_primus.js", "max_issues_repo_name": "davedoesdev/centro", "max_issues_repo_issues_event_min_datetime": "2019-11-02T09:55:14.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-26T02:07:44.000Z", "max_forks_repo_path": "test/example/node/publish_primus.js", "max_forks_repo_name": "davedoesdev/centro", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 2, "max_issues_count": 10, "max_forks_count": null, "avg_line_length": 28.8928571429, "max_line_length": 73, "alphanum_fraction": 0.6106304079}
/*eslint-env node */
"use strict";

const centro = require('../../..');
const assert = require('assert');
const Primus = require('primus');
const Socket = Primus.createSocket({
    pathname: '/centro/v' + centro.version + '/primus'
});
const PrimusDuplex = require('primus-backpressure').PrimusDuplex;

centro.separate_auth({
    token: process.env.CENTRO_TOKEN
}, function (err, userpass, make_client) {
    assert.ifError(err);

    const socket = new Socket('http://' + userpass + '@localhost:8801',
                              { strategy: false });
    const duplex = new PrimusDuplex(socket);

    make_client(duplex).on('ready', function () {
        process.stdin.pipe(this.publish(process.argv[2], function (err) {
            assert.ifError(err);
            duplex.end();
        }));
    });
});
