I would like to return if true or false the user exists by retrieving the information of a user, if there is information then we return true, otherwise we return false. The problem is that in my res.on('end') I recover the user data well, but it is impossible to recover his data outside of this function. Do you have an idea ?
this.api.getEnv() = http (dev) or https (prod)
        GetUserById = function (id) {
        const req = this.api.getEnv().request(this.api.ApiHeader('/user/' + this.PlayerIdentifiers(id, "license"), 'GET'), res => {
            let body = '';
            res.on('data', d => {
                body += d;
            });
            res.on('end', function () {
                const user = JSON.parse(body);
                console.log(user);
            });
            if (user) {
                return true;
            } else {
                return false;
            }
        });
 
    