Guest User

Untitled

a guest
Oct 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. 'use strict';
  2. // node --experimental-modules index.mjs
  3.  
  4. import fs from 'fs';
  5.  
  6. import util from 'util';
  7.  
  8. const readFile = util.promisify(fs.readFile);
  9.  
  10. const fnThen = (result) => {
  11. console.log('result', result.toString());
  12. }
  13.  
  14. const fnCatch = (error) => {
  15. console.log('error', error);
  16. }
  17.  
  18. readFile('./package.json')
  19. .then(fnThen)
  20. .catch(fnCatch);
Add Comment
Please, Sign In to add comment