Skip to content

Instantly share code, notes, and snippets.

@jessecogollo
Created October 23, 2017 07:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jessecogollo/c7ecbec5b8f404ab99a0ec2b522675cd to your computer and use it in GitHub Desktop.
Save jessecogollo/c7ecbec5b8f404ab99a0ec2b522675cd to your computer and use it in GitHub Desktop.
esm
'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