workshopper / learnyounode

Learn You The Node.js For Much Win! An intro to Node.js via a set of self-guided workshops.
Other
7.25k stars 1.84k forks source link

MY FIRST ASYNC I/O! - Not accepting solution with Promises #654

Closed shivangg closed 5 years ago

shivangg commented 5 years ago

The outputs match but the solutions fails without any reason

const fs = require('fs');
const util = require('util');
const readFile = util.promisify( fs.readFile );

readFile(process.argv[2])
.then( data => {
  let fileContentsLength = data.toString().split('\n').length - 1;
  console.log(fileContentsLength);
})
.catch( err => {
  console.error(err);
});

Output image

shanmukhateja commented 5 years ago

This issue can be closed as it has been fixed in v4.0.1.

PR for reference: #667