Skip to content

Conversation

sueanyv
Copy link

@sueanyv sueanyv commented Mar 13, 2017

No description provided.

var dataNum = [];

fs.readFile(pathArray[0], function(err, data) {
if (err) callback(err);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job calling the callback with the err.

@@ -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.

The first 8 bytes of your test files are all the same. Each one needs to be different in order for you to tell if they are logging out in the order that you are looking for.


const gulp = require('gulp');
const eslint = require('gulp-eslint');
const mocha = require('gulp-mocha');
Copy link

@jalleng jalleng Mar 13, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are requiring gulp-mocha here but it is not in your package.json. Make sure that you save it as a devDependency.

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.

Your index should just call the function that you set up in file-reader.js one time and hand it a callback. So you can run 'node index.js in the terminal and see it output the three files in order.

console.log(dataNum);
callback(null, dataNum);

});
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job with this. I like that your function takes an array of file names as a parameter.

done();
});
it('should have correct order of hex strings', (done) => {
var dataNum = ['48656c6c6f207468', '48656c6c6f207468', '48656c6c6f207468'];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are all the same. How can you tell what order they are coming back in?

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