Tag Archives: fibers

“Synchronous” MongoDB Calls with Fibers

Here I’m showing an example of converting MongoDB node driver into “synchronous” APIs from callback based asynchronous APIs. We define two new classes to wrap up the native Db and Cursor. Two methods are converted: Db.Open and Cursor.toArray. The “sync” … Continue reading

Posted in JavaScript, Node.js, NoSQL | Tagged , , | Comments Off on “Synchronous” MongoDB Calls with Fibers

Node-Fibers Example

With node-fibers, we can write codes in traditionally synchronous fashion and avoid deep nested callback calls without blocking the Node event loop. Below is an example to generate Fibonacci series. Each run resumes the calculation loop and returns a number … Continue reading

Posted in JavaScript, Node.js | Tagged , | Comments Off on Node-Fibers Example