|
@@ -93,7 +93,7 @@ function delFile() {
|
|
function getLastFile(dirPath, number, callback) {
|
|
function getLastFile(dirPath, number, callback) {
|
|
fs.readdir(dirPath, async (err, files) => {
|
|
fs.readdir(dirPath, async (err, files) => {
|
|
if (err) {
|
|
if (err) {
|
|
- console.error(`Could not list the directory.`, err);
|
|
|
|
|
|
+ console.error(`无法列出目录。`, err);
|
|
process.exit(1);
|
|
process.exit(1);
|
|
}
|
|
}
|
|
let fileList = [];
|
|
let fileList = [];
|
|
@@ -123,7 +123,7 @@ function readLastNLines(dirPath, filePathList, n) {
|
|
};
|
|
};
|
|
});
|
|
});
|
|
const allFile = [].concat(...fileList.map((item) => item.lines));
|
|
const allFile = [].concat(...fileList.map((item) => item.lines));
|
|
- const lastNLines = allFile.slice(-n).join("\n");
|
|
|
|
|
|
+ let lastNLines = allFile.slice(-n).join("\n");
|
|
return lastNLines.split("\n").reverse();
|
|
return lastNLines.split("\n").reverse();
|
|
}
|
|
}
|
|
|
|
|