Saturday 10 June 2017

Do i need Promise.promisifyAll() in every module file?

If i need fs in multiple files with Promise (Bluebird), should i call every time Promise.promisifyAll(require('fs')) ? Or would it be better with a small module with

module.exports = Promise.promisifyAll(require('fs'))

and only import that module?

If i get it right, my first choice will every time promisfy the fs module and the second will only link to the same module, which is only one time promisfyed. Or will be my first choice doing the same like my second?



via Defkil

No comments:

Post a Comment