The sync wrapper will only help you if you are using node to write command line scripts. You should *never* use sync calls when processing server events. And the fact that it takes less than 1 s is no excuse because node can process a lot of events in 1 s, even in 1 ms!
The only way to return a value from an async function is via a callback. And the calling function will have exited when the callback is called. So you'll run into that problem all the time, with all sorts of node modules and APIs. So don't try to fight it with sync wrappers; instead, get used to callbacks. If you find callbacks too difficult, you should look for tools that let you program node in sync style. These tools come in 3 flavors: CPS transforms, fibers (coroutines) and ES6 generators. These tools do *not* turn APIs into blocking sync calls. They use other tricks that preserve the async nature of node and let the event loop run at full speed. Just google around. Bruno -- -- Job Board: http://jobs.nodejs.org/ Posting guidelines: https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines You received this message because you are subscribed to the Google Groups "nodejs" group. To post to this group, send email to nodejs@googlegroups.com To unsubscribe from this group, send email to nodejs+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/nodejs?hl=en?hl=en --- You received this message because you are subscribed to the Google Groups "nodejs" group. To unsubscribe from this group and stop receiving emails from it, send an email to nodejs+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.