{"name":"log-update","version":"7.0.2","keywords":["log","logger","logging","cli","terminal","term","console","shell","update","refresh","overwrite","output","stdout","progress","bar","animation"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"log-update@7.0.2","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/log-update#readme","bugs":{"url":"https://github.com/sindresorhus/log-update/issues"},"xo":{"rules":{"n/no-extraneous-import":"off","import-x/no-extraneous-dependencies":"off","@typescript-eslint/no-unsafe-argument":"off"}},"dist":{"shasum":"eddb498d154f29523a897d4f901a2c3d4b57f8f0","tarball":"http://registry-npm.ywwl.com/log-update/download/log-update-7.0.2.tgz","fileCount":5,"integrity":"sha512-cSSF1K5w9juI2+JeSRAdaTUZJf6cJB0aWwWO1nQQkcWw44+bIfXmhZMwK2eEsv6tXvU3UfKX/kzcX6SP+1tLAw==","signatures":[{"sig":"MEQCIB0rXTqR5k/eokqVY2zCKI1P8MONAnZfpcq6XN1Ox//QAiAGHFSogPx9Jn2jFZnvDLnKkGk8zsgyr0IFsUzWdkiY9g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16235,"size":5214,"noattachment":false,"key":"/log-update/-/log-update-7.0.2.tgz"},"type":"module","types":"./index.d.ts","engines":{"node":">=20"},"exports":{"types":"./index.d.ts","default":"./index.js"},"funding":"https://github.com/sponsors/sindresorhus","gitHead":"5576a6bc1e74b33af575cbf2dbc14a9cd4be259e","scripts":{"test":"xo && node --test && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/log-update.git","type":"git"},"_npmVersion":"11.6.1","description":"Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"wrap-ansi":"^9.0.2","cli-cursor":"^5.0.0","slice-ansi":"^7.1.2","strip-ansi":"^7.1.2","ansi-escapes":"^7.1.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","tsd":"^0.33.0","wcwidth":"^1.0.1","@types/node":"^24.4.0","terminal.js":"^1.0.11","string-width":"^8.1.0"},"_npmOperationalInternal":{"tmp":"tmp/log-update_7.0.2_1763541231467_0.8504243171163659","host":"s3://npm-registry-packages-npm-production"},"readme":"# log-update\n\n> Log by overwriting the previous output in the terminal.\\\n> Useful for rendering progress bars, animations, etc.\n\n![](screenshot.gif)\n\nIt performs partial redraws when possible to reduce flicker.\n\n## Install\n\n```sh\nnpm install log-update\n```\n\n## Usage\n\n```js\nimport logUpdate from 'log-update';\n\nconst frames = ['-', '\\\\', '|', '/'];\nlet index = 0;\n\nsetInterval(() => {\n\tconst frame = frames[index = ++index % frames.length];\n\n\tlogUpdate(\n`\n        ♥♥\n   ${frame} unicorns ${frame}\n        ♥♥\n`\n\t);\n}, 80);\n```\n\nYou can use [yoctocolors](https://github.com/sindresorhus/yoctocolors) or [chalk](https://github.com/chalk/chalk) to colorize the output.\n\n## API\n\n### logUpdate(text…)\n\nLog to stdout.\n\n### logUpdate.clear()\n\nClear the logged output.\n\n### logUpdate.done()\n\nPersist the logged output.\n\nUseful if you want to start a new log session below the current one.\n\n### logUpdate.persist(text…)\n\nWrite text to the terminal that persists, similar to `console.log()`.\n\nUnlike the main `logUpdate()` method which updates in place, `persist()` writes to the terminal in a way that preserves the output in the scrollback history.\n\n```js\nimport logUpdate from 'log-update';\n\n// Update in place\nlogUpdate('Processing...');\nlogUpdate('Still processing...');\n\n// Write permanent output\nlogUpdate.persist('✓ Task complete');\n\n// Continue updating\nlogUpdate('Next task...');\n```\n\n### logUpdateStderr(text…)\n\nLog to stderr.\n\n### logUpdateStderr.clear()\n### logUpdateStderr.done()\n### logUpdateStderr.persist(text…)\n\n### createLogUpdate(stream, options?)\n\nGet a `logUpdate` method that logs to the specified stream.\n\n#### options\n\nType: `object`\n\n##### showCursor\n\nType: `boolean`\\\nDefault: `false`\n\nShow the cursor. This can be useful when a CLI accepts input from a user.\n\n```js\nimport {createLogUpdate} from 'log-update';\n\n// Write output but don't hide the cursor\nconst log = createLogUpdate(process.stdout, {\n\tshowCursor: true\n});\n```\n\n##### defaultWidth\n\nType: `number`\\\nDefault: `80`\n\nThe width to use when the stream doesn't provide a `columns` property.\n\nThis is useful when the output is piped, redirected, or in environments where the terminal size is not available.\n\n```js\nimport {createLogUpdate} from 'log-update';\n\n// Use custom width when the stream doesn't provide columns\nconst log = createLogUpdate(process.stdout, {\n\tdefaultWidth: 120\n});\n```\n\n##### defaultHeight\n\nType: `number`\\\nDefault: `24`\n\nThe height to use when the stream doesn't provide a `rows` property.\n\nThis is useful when the output is piped, redirected, or in environments where the terminal size is not available.\n\n```js\nimport {createLogUpdate} from 'log-update';\n\n// Use custom height when the stream doesn't provide rows\nconst log = createLogUpdate(process.stdout, {\n\tdefaultHeight: 50\n});\n```\n\n## Examples\n\n- [listr](https://github.com/SamVerschueren/listr) - Uses this module to render an interactive task list\n- [ora](https://github.com/sindresorhus/ora) - Uses this module to render awesome spinners\n- [speed-test](https://github.com/sindresorhus/speed-test) - Uses this module to render a [spinner](https://github.com/sindresorhus/elegant-spinner)\n","publish_time":1763541231697,"_cnpm_publish_time":1763541231697,"dist-tags":{"latest":"8.0.0"}}