Created
September 15, 2012 05:05
-
-
Save eiffelqiu/3726394 to your computer and use it in GitHub Desktop.
Test Nodejs read and write file performance
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var fs = require('fs'); | |
var from = new Date().getTime(); | |
for (var i = 1; i <= 10; i++) { | |
fs.readFile("test.mp4",function(err, data) { | |
if(err) | |
console.log("read error: ", err); | |
else { | |
fs.writeFile(__dirname + "/new.mp4", data , function(err) { | |
if(err) { | |
console.log("write error: ", err); | |
} else { | |
console.log("length: ", (new Date().getTime() - from)/1000); | |
} | |
}); | |
} | |
}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment