ts-tqdm is a Node.js utility library that provides a progress bar functionality, directly inspired by the popular Python `tqdm` library. It allows developers to easily instrument loops, whether iterating over arrays or a fixed number of iterations, with visual progress feedback in the console. The current stable version is 0.8.6. As a focused utility, its release cadence is typically driven by feature enhancements or bug fixes. Its primary differentiator lies in its TypeScript-first design, ensuring type safety and excellent developer experience for TypeScript projects, while replicating the simple, intuitive API familiar to users of `tqdm` in other ecosystems. It is best suited for command-line applications and scripts where visual progress indication can significantly improve user experience for long-running operations.
npm install ts-tqdmVerified import paths — ran on the pinned version, not inferred.
Demonstrates `tqdm` usage for both fixed iterations and array iteration, with asynchronous tasks.
Avoid `console.log` within the loop body. If logging is necessary, consider buffering messages and printing them after the loop, or using `tqdm`'s internal logging mechanisms if available (not currently in `ts-tqdm`), or redirecting logs to a file.
Check `process.stdout.isTTY` before conditionally enabling `tqdm`. For non-TTY environments, simply iterate without wrapping in `tqdm` or use a different logging approach. The library will gracefully degrade to no output if no TTY is detected.
Use browser-specific progress bar libraries for front-end applications. `ts-tqdm` is designed for server-side or command-line Node.js scripts.
Ensure you are using `import { tqdm } from 'ts-tqdm';` for ESM modules. For older Node.js versions or specific configurations, ensure proper transpilation if using ES Modules.Ensure the argument passed to `tqdm` is an `Iterable` (e.g., `Array`, `Set`, `Map`) or a `number`. For example, `tqdm([1, 2, 3])` or `tqdm(100)`.
No dependency data recorded yet.