{"name":"log-update","version":"7.2.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.2.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":"cd6c87c1270c80b53fa1d6d8ac5b2c624a286258","tarball":"http://registry-npm.ywwl.com/log-update/download/log-update-7.2.0.tgz","fileCount":5,"integrity":"sha512-iLs7dGSyjZiUgvrUvuD3FndAxVJk+TywBkkkwUSm9HdYoskJalWg5qVsEiXeufPvRVPbCUmNQewg798rx+sPXg==","signatures":[{"sig":"MEYCIQD5OEf6m0aOonaX2h70ZClFhW+tiLc532GFuQbB11BBCgIhAKPBfCjTHC5nV04nCIE/GcGorSxI/wka7V70lEmhCqy9","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":16631,"size":5332,"noattachment":false,"key":"/log-update/-/log-update-7.2.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":"3af5ea02c2503ff3268f8dde64e1266da21966f9","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.8.0","description":"Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.","directories":{},"sideEffects":false,"_nodeVersion":"25.6.0","dependencies":{"wrap-ansi":"^10.0.0","cli-cursor":"^5.0.0","slice-ansi":"^8.0.0","strip-ansi":"^7.2.0","ansi-escapes":"^7.3.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.3","tsd":"^0.33.0","wcwidth":"^1.0.1","@types/node":"^25.3.2","terminal.js":"^1.0.11","string-width":"^8.2.0"},"_npmOperationalInternal":{"tmp":"tmp/log-update_7.2.0_1772167874507_0.2950826528350763","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":1772167874659,"_cnpm_publish_time":1772167874659,"dist-tags":{"latest":"8.0.0"}}