{"_id":"@alt-jero/status-line","name":"@alt-jero/status-line","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@alt-jero/status-line","version":"1.0.0","description":"A quick and simple way to write status updates at the bottom of the CLI display without logging all status updates to the line-buffer.","main":"index.js","scripts":{"test":"node ./benchmark.js"},"keywords":["status","CLI","logging"],"author":{"name":"Jeremy Rumble"},"license":"SEE LICENSE IN LICENSE.MIT.md","gitHead":"963a5d783cf6c371e412db2e5dd225bae62b963b","_id":"@alt-jero/status-line@1.0.0","_nodeVersion":"18.8.0","_npmVersion":"8.18.0","dist":{"integrity":"sha512-p+Q3n11+y/9tiyPsc+Agk/MO7F0hqbrfahVGWFmvzcCgRz+jNF2IEr4a9xj6e2CyJB0JPeM31PV+h8Vu2jCvcQ==","shasum":"3b8d4a8f5ab4086f9ecdad9a78af156ba7120e74","tarball":"https://registry.npmjs.org/@alt-jero/status-line/-/status-line-1.0.0.tgz","fileCount":5,"unpackedSize":5980,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIGl0HSantxcwCnD4iTXP4J0YtHVVN9fU+PT/TDraR52UAiEAngpJQT13ij7L+H85MID4YQaWzyhavRZLA4TQ3gfl+Mw="}]},"_npmUser":{"name":"alt-jero","email":"jero.rumble@gmail.com"},"directories":{},"maintainers":[{"name":"alt-jero","email":"jero.rumble@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/status-line_1.0.0_1685804406853_0.07536977917301058"},"_hasShrinkwrap":false}},"time":{"created":"2023-06-03T15:00:06.779Z","1.0.0":"2023-06-03T15:00:07.027Z","modified":"2023-06-03T15:00:07.217Z"},"maintainers":[{"name":"alt-jero","email":"jero.rumble@gmail.com"}],"description":"A quick and simple way to write status updates at the bottom of the CLI display without logging all status updates to the line-buffer.","keywords":["status","CLI","logging"],"author":{"name":"Jeremy Rumble"},"license":"SEE LICENSE IN LICENSE.MIT.md","readme":"# StatusLine\n\n## Introduction\nThis tiny package was an attempt to create a simple way of adding a status line at the bottom of a console when running node.js code in a CLI environment.\n\n## Installation\n\n```bash\n$ npm i @alt-jero/status-line\n```\n\n## Usage\n```javascript\nconst statusLine = require('@alt-jero/status-line');\n\n// Set/overwrite bottom line of console display\nstatusLine(`I'm really-fast, but ephemeral.`)\n\n// Write a non-ephemeral line to the display (fast)\nstatusLine.logString(`I'm fast and stay in your line-buffer.`)\n\n// Write via console.log while taking status line into account (slower)\nstatusLine.log(`I'm slower, but can handle objects and arrays.`)\n\n// Write out an error report to the display\nstatusLine.error(new Error(`We'll see a stack-trace without the status line getting involved!`))\n```\n\n## Benchmark\n I have attempted to make it as fast as possible without sacrificing utility. To that end, it's possible to use the normal  `.log()` and `.error()` methods which forward the given data to `console.log()` and `console.error()` respectively after clearing the status line. In the interest of speed, it's also possible to use the `.logString()` method if you know you just want to write a string. The latter method uses `process.stdout.write()` in the background, also taking the presence of the status line into account.\n\n Below is the result of a benchmark run on my own computer: A macbook air from mid-2013 (I know, dinosaur xD) with the i7 processor and 8GiB RAM. The results show the difference in speed is miniscule.\n\n> The following have been benchmarked with 250,000 iterations:\n> 1. process.stdout         took 1.771997629 seconds\n> 2. statusLine()           took 1.462698296 seconds\n> 3. statusLine.logString() took 2.345646944 seconds\n> 4. console.log()          took 2.327852828 seconds\n> 5. statusLine.log()       took 3.441730405 seconds\n\n\nIf you want to run the benchmark yourself, first **be warned that the benchmark will obliterate the contents of your line buffer**, as it needs to output about 1.25M lines of `Running benchmark...` in order to complete the test. \nYou can run the benchmark like so:\n```bash\n$ npm run test\n```\n","readmeFilename":"README.md"}