Created
September 20, 2017 10:17
-
-
Save likai24/972a5ed0a70f090d4f2026fcf9ac53b8 to your computer and use it in GitHub Desktop.
用nodejs来读文件 node file.js 文件名
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 path = process.argv.slice(2).pop(); | |
var start = new Date(); | |
var readStream = fs.createReadStream(path); | |
readStream | |
.on('data', function (chunk) { | |
}) | |
.on('end', function () { | |
var end = new Date(); | |
console.log((end - start)/1000 + "second ") | |
console.log(path + " load is done"); | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment