samedi 28 février 2015

node.js command line tool

I am writing my very first command line tool with node.js. I'm familiar with the concept of async io and understand the benefits of using it. I am wondering however, since this tool will do the following:



  1. Perform some FS operations (e.g. create folder, write to some files)

  2. Make a network request (e.g. download some stuff into this folder)

  3. Produce a result (meaning a bunch of files)

  4. Exit


Should I really be using all the async versions for these methods? for instance mkdirp() is also available as mkdirpSync() (from the fs-extra module), so the real question is:



Why do I even have to bother using async functions in a program that is due to terminate upon completion? and has no real impact in case the application thread is blocked?



Thanks.


Aucun commentaire:

Enregistrer un commentaire