{"_id":"log-update-ts","name":"log-update-ts","dist-tags":{"latest":"0.1.0"},"versions":{"0.1.0":{"name":"log-update-ts","version":"0.1.0","description":"Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.","license":"MIT","type":"module","main":"./dist/index.js","types":"./dist/index.d.ts","bin":{"log-update-ts":"dist/cli.js"},"scripts":{"build":"tsc","start":"node dist/cli.js","dev":"tsc && node dist/cli.js","prepublishOnly":"npm run build"},"engines":{"node":">=18"},"devDependencies":{"@types/node":"^22.10.0","typescript":"^5.7.0"},"keywords":["log","logger","logging","cli","terminal","term","console","shell","update","refresh","overwrite","output","stdout","progress","bar","animation"],"gitHead":"d2ac7473890fd7d568de7e8200b19e84325ce662","_id":"log-update-ts@0.1.0","_nodeVersion":"18.19.1","_npmVersion":"9.2.0","dist":{"integrity":"sha512-eix0zsjA31Worh9hmMXWM4w3oM1husPL4PLq6q3wx32eQwk7qXA/qIxmv4HKCQTUg53yLgimf+uN+izyX7yqiw==","shasum":"1846c3bd2509467db83b2ef8adddb134d8a456ff","tarball":"https://registry.npmjs.org/log-update-ts/-/log-update-ts-0.1.0.tgz","fileCount":22,"unpackedSize":50254,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDTVrNl189KdvRuvuVwYg63JB9Cejs0wDSmmYux1gYSqgIgat0LxjsxHZL6hc4rL1cjqKJCP6taXn9ZdSzlCLinSuA="}]},"_npmUser":{"name":"satoshitomita0311","email":"satoshitomita0311@gmail.com"},"directories":{},"maintainers":[{"name":"satoshitomita0311","email":"satoshitomita0311@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/log-update-ts_0.1.0_1782375764494_0.820856504221338"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-25T08:22:44.340Z","0.1.0":"2026-06-25T08:22:44.629Z","modified":"2026-06-25T08:22:44.811Z"},"maintainers":[{"name":"satoshitomita0311","email":"satoshitomita0311@gmail.com"}],"description":"Log by overwriting the previous output in the terminal. Useful for rendering progress bars, animations, etc.","keywords":["log","logger","logging","cli","terminal","term","console","shell","update","refresh","overwrite","output","stdout","progress","bar","animation"],"license":"MIT","readme":"# log-update-ts\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-ts\n```\n\n## Usage\n\n```js\nimport logUpdate from 'log-update-ts';\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-ts';\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-ts';\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-ts';\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-ts';\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","readmeFilename":"ReadME.md","_rev":"1-ee81d882d9da2a20d0e9bf1e2889835e"}