From 703e03aba33f234712206769f57717ba7d92d23d Mon Sep 17 00:00:00 2001 From: LinuxWizard42 Date: Wed, 12 Oct 2022 22:54:37 +0300 Subject: Added export_allowed file to make repository visible in cgit --- node_modules/single-line-log/README.md | 56 ++++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 node_modules/single-line-log/README.md (limited to 'node_modules/single-line-log/README.md') diff --git a/node_modules/single-line-log/README.md b/node_modules/single-line-log/README.md new file mode 100644 index 0000000..f142e30 --- /dev/null +++ b/node_modules/single-line-log/README.md @@ -0,0 +1,56 @@ +# single-line-log + +Node.js module that keeps writing to the same line in the console (or a stream). Very useful when you write progress bars, or a status message during longer operations. Supports multilines. + + +## Installation + + npm install single-line-log + + +## Usage + +``` js +var log = require('single-line-log').stdout; +// or pass any stream: +// var log = require('single-line-log')(process.stdout); + +var read = 0; +var size = fs.statSync('super-large-file').size; + +var rs = fs.createReadStream('super-large-file'); +rs.on('data', function(data) { + read += data.length; + var percentage = Math.floor(100*read/size); + + // Keep writing to the same two lines in the console + log('Writing to super large file\n[' + percentage + '%]', read, 'bytes read'); +}); +``` + +## .clear() + +Clears the log (i.e., writes a newline). + +``` js +var log = require('single-line-log').stdout; + +log('Line 1'); +log.clear(); +log('Line 2'); +``` + + +## .stdout + +Outputs to `process.stdout`. + + +## .stderr + +Outputs to `process.stderr`. + + +## License + +MIT \ No newline at end of file -- cgit v1.2.3-86-g962b