-
Notifications
You must be signed in to change notification settings - Fork 15
completed #20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
completed #20
Conversation
@@ -0,0 +1 @@ | |||
Hello this is test two |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should make your sample test different for each file. You are only reading the beginning of each string and they all start the same here. So you won't know which order they are coming out.
|
||
const fs = require('fs'); | ||
|
||
const fileReader = require('./lib/file-reader.js') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good job requiring in your function.
fileReader(`${__dirname}/./data/two.txt`, function(err, data) { | ||
if (err) throw err; | ||
console.log('three:', data.toString('hex', 0, 8)); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should have one function that reads all three files 'in order'. Not a function that reads one file that you call three times. There is also no way with the way you are doing it here to guarantee that they come back in order.
if (err) callback(err); | ||
return callback(null, data.toString('hex',0,8)); | ||
}); | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using the readFile function correctly to read a file. But you need to be reading all three files in order.
done(); | ||
}); | ||
}); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The way you set up your test here is similar to the way that you should set up your function in the file-reader.js file.
No description provided.