Skip to content
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

NodeJS_1_Introducao/files.js Warning: No such label 'file' for console.timeEnd() #24

Open
souzace opened this issue Oct 30, 2017 · 0 comments

Comments

@souzace
Copy link

souzace commented Oct 30, 2017

For some reason, console.time and console.timeEnd, just work inside scope of function fs.readFile:

Original:

console.time('file');
var thread = 1;
var count = 1;
while(count <= 6) {
	fs.readFile('./file.mov', function (err, data) {
		console.log("Thread #" + thread++ + " finish");
		console.timeEnd('file');
	});
	count++;
}

My:

var thread = 1;
var count = 1;
while(count <= 6) {
    fs.readFile('./imagem.iso', function (err, data) {
                console.time('file');
	        console.log("Thread #" + thread++ + " finish");
		console.timeEnd('file');
	});
	count++;
}

My node version v6.11.2

@souzace souzace changed the title NodeJS_1_Introducao/files.js NodeJS_1_Introducao/files.js Warning: No such label 'file' for console.timeEnd() Oct 30, 2017
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

No branches or pull requests

1 participant