Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- resolveData: function(env, cb) {
- var dir = logsDirectory + "/" + env;
- var results = [];
- fs.readdir(dir, function(err, files) {
- if (err) {
- throw err;
- }
- var logFile = getNewestFile(files, dir)
- fs.createReadStream(dir + '/' + logFile, 'utf8')
- .pipe(split())
- .on('data', function(line) {
- var linesLength = 100;
- var lines = line.split('n');
- results.push({
- data: lines
- });
- console.log(line);
- });
- }, function(err) {
- if (err)
- throw err;
- cb(null, results);
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement