Created
May 10, 2017 01:40
-
-
Save styfle/ac4e108eba98000c196f4229ae30f2cd to your computer and use it in GitHub Desktop.
Promises in Node.js 8.x Core
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function requirePromise(modName, fnName) { | |
return require('util').promisify(require(modName)[fnName]); | |
} | |
const stat = requirePromise('fs', 'stat'); | |
const writeFile = requirePromise('fs', 'writeFile'); | |
const appendFile = requirePromise('fs', 'appendFile'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment