Is it possible to abort a function after a delay? Something like:
function f() {
//Do some process here
}
after(10000).stop(f)
Any idea about how to do that? Thank you.
Try cluster module like this
const cluster = require('cluster');
if (cluster.isMaster) {
const fn = cluster.fork();
setTimeout(_=>fn.process.kill(), 300);
} else {
for(;;) {
process.stdout.write('#');
}
}