{"name":"log-update","version":"7.0.0","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.0","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":"699b4d40d2e3bbb05d447eceae2121d8c98986d0","tarball":"http://registry-npm.ywwl.com/log-update/download/log-update-7.0.0.tgz","fileCount":5,"integrity":"sha512-7nFktN18ewPaxYC7ZkGbw5c90aF3nTG7XnKvGxCvz9zCsVLSImbRMRRkPOhirhDvizd8uGzrIHzo5Wh1ctuzLw==","signatures":[{"sig":"MEUCIQDAX0YjDIMjJIwLQ30yY6uADXhW6ob6qg1kNFGJFaVs5gIgdzIav7ryb9cX5Bqk4Jr1aczhicAiZd51yMZJ4O1rUcs=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":15924,"size":5147,"noattachment":false,"key":"/log-update/-/log-update-7.0.0.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":"8a2344df9718fcdaec4ac6d9fd25c72add849e8b","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":"10.9.2","description":"Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.","directories":{},"sideEffects":false,"_nodeVersion":"20.19.1","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.0_1757950430348_0.18003287689614056","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":1757950430537,"_cnpm_publish_time":1757950430537,"dist-tags":{"latest":"8.0.0"}}