Skip to content

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

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Conversation

sueanyv
Copy link

@sueanyv sueanyv commented Feb 28, 2017

No description provided.

@@ -0,0 +1 @@
Hello this is test two
Copy link

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')
Copy link

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));
});
Copy link

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));
});
};
Copy link

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();
});
});
});
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants