Created
October 23, 2017 07:10
-
-
Save jessecogollo/c7ecbec5b8f404ab99a0ec2b522675cd to your computer and use it in GitHub Desktop.
esm
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
'use strict'; | |
// node --experimental-modules index.mjs | |
import fs from 'fs'; | |
import util from 'util'; | |
const readFile = util.promisify(fs.readFile); | |
const fnThen = (result) => { | |
console.log('result', result.toString()); | |
} | |
const fnCatch = (error) => { | |
console.log('error', error); | |
} | |
readFile('./package.json') | |
.then(fnThen) | |
.catch(fnCatch); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment