I spent some time on Node Bcrypt and how they achieved the following asynchronous execution:
bcrypt.hash(myPlaintextPassword, saltRounds, function(err, hash) {
});
They perform expensive computational tasks (salt generation) using asynchronous callbacks. How do they do this without blocking the main flow of Node IO?
I read about process.nextTick (), but it looks like setTimeout (), in which you distribute the load on the processor over a single thread (delaying payment by piper). Then there is childProcess.fork (), but I don’t think they are using this since I cannot find it anywhere in the GitHub repo .
In addition, you have libraries like Monk that achieve:
users.find({ name: 'Loki' }, '-bigdata').then(function () {
})
repo fork(). , , , - .
, , . - , ?