diff options
author | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 23:08:57 +0300 |
---|---|---|
committer | LinuxWizard42 <computerwizard@linuxmail.org> | 2022-10-12 23:08:57 +0300 |
commit | 726b81b19251674e149ccfbb1abacbd837fc6db0 (patch) | |
tree | fbdbb227dc01357eb76e8222d76185bc124c5ca6 /node_modules/single-line-log/index.js | |
parent | 34f0890e175698940d49238097579f44e4d78c89 (diff) | |
download | FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.gz FlashRunner-726b81b19251674e149ccfbb1abacbd837fc6db0.tar.zst |
Removed files that should not have been included in git
Diffstat (limited to 'node_modules/single-line-log/index.js')
-rw-r--r-- | node_modules/single-line-log/index.js | 51 |
1 files changed, 0 insertions, 51 deletions
diff --git a/node_modules/single-line-log/index.js b/node_modules/single-line-log/index.js deleted file mode 100644 index c1201be..0000000 --- a/node_modules/single-line-log/index.js +++ /dev/null @@ -1,51 +0,0 @@ -var MOVE_LEFT = new Buffer('1b5b3130303044', 'hex').toString(); -var MOVE_UP = new Buffer('1b5b3141', 'hex').toString(); -var CLEAR_LINE = new Buffer('1b5b304b', 'hex').toString(); -var stringWidth = require('string-width'); - -module.exports = function(stream) { - var write = stream.write; - var str; - - stream.write = function(data) { - if (str && data !== str) str = null; - return write.apply(this, arguments); - }; - - if (stream === process.stderr || stream === process.stdout) { - process.on('exit', function() { - if (str !== null) stream.write(''); - }); - } - - var prevLineCount = 0; - var log = function() { - str = ''; - var nextStr = Array.prototype.join.call(arguments, ' '); - - // Clear screen - for (var i=0; i<prevLineCount; i++) { - str += MOVE_LEFT + CLEAR_LINE + (i < prevLineCount-1 ? MOVE_UP : ''); - } - - // Actual log output - str += nextStr; - stream.write(str); - - // How many lines to remove on next clear screen - var prevLines = nextStr.split('\n'); - prevLineCount = 0; - for (var i=0; i < prevLines.length; i++) { - prevLineCount += Math.ceil(stringWidth(prevLines[i]) / stream.columns) || 1; - } - }; - - log.clear = function() { - stream.write(''); - }; - - return log; -}; - -module.exports.stdout = module.exports(process.stdout); -module.exports.stderr = module.exports(process.stderr); |