Skip to content

Instantly share code, notes, and snippets.

@eiffelqiu
Created September 15, 2012 05:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eiffelqiu/3726394 to your computer and use it in GitHub Desktop.
Save eiffelqiu/3726394 to your computer and use it in GitHub Desktop.
Test Nodejs read and write file performance
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