I'm new to ldapjs and ldap in general. I have the following code currently:
var search = client.search(base, opts, function(err, res) {
assert.ifError(err);
res.on('searchEntry', function(entry) {
console.log('entry: ' + JSON.stringify(entry.object));
});
res.on('searchReference', function(referral) {
console.log('referral: ' + referral.uris.join());
});
res.on('error', function(err) {
console.error('error: ' + err.message);
});
res.on('end', function(result) {
console.log('status: ' + result.status);
});
});
My search occurs correctly and finds everything needed. My issue is that it does successfully get to res.on('end') and prints out the status code (0) but the script I'm running never "officially" ends and thus causes me to have to perform a keyboard interrupt.
Additionally I tried using res.end() but was informed this was not a function. Is there something I am missing entirely? Thanks!