Beispiel #1
0
 filenames.forEach(filename => {
   gzipme(filename, false, 'best', () => {
     counter++;
     if (counter >= filenames.length) {
       resolve();
     }
   });
 });
Beispiel #2
0
					fs.stat(CONFIGURATION.log.path + file, function(error, stats) {
						if (error && error.code == 'ENOENT') {
							// there is no any log file yet
						} else {
							// log file exist, let's check it's size
							// console.log(stats);
							if (stats.size >= (CONFIGURATION.log.maxSize * 1024)) {
								// current log file exceded limit, let's compress it
								var gzipme = require('gzipme');
								gzipme(CONFIGURATION.log.path + file);
								// generate new log filename
								file = 'log.' + (Number(file.split(".")[1]) + 1);
								// write new log filename to the hidden file '.log'
								fs.writeFile(CONFIGURATION.log.path + '.log', file, {
									'flag': 'w'
								}, function(err) {
									if (err) return console.log(err);
								});
							}
						}
						resolve(file);
					});