{"name":"ora","version":"9.0.0","keywords":["cli","spinner","spinners","terminal","term","console","ascii","unicode","loading","indicator","progress","busy","wait","idle"],"author":{"url":"https://sindresorhus.com","name":"Sindre Sorhus","email":"sindresorhus@gmail.com"},"license":"MIT","_id":"ora@9.0.0","maintainers":[{"name":"sindresorhus","email":"sindresorhus@gmail.com"}],"homepage":"https://github.com/sindresorhus/ora#readme","bugs":{"url":"https://github.com/sindresorhus/ora/issues"},"dist":{"shasum":"945236f5ce78a024cf4c25df6c46ecd09ab6e685","tarball":"http://registry-npm.ywwl.com/ora/download/ora-9.0.0.tgz","fileCount":5,"integrity":"sha512-m0pg2zscbYgWbqRR6ABga5c3sZdEon7bSgjnlXC64kxtxLOyjRcbbUkLj7HFyy/FTD+P2xdBWu8snGhYI0jc4A==","signatures":[{"sig":"MEQCIDU5vo9tkJEJxZs84qS57c29fjYZn2ppFN6FwLAefMg+AiBUmB+V2kH2GdWvmXH5UQfrGwD9M/70u7bgz3OaE2r0CQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":30350,"size":8440,"noattachment":false,"key":"/ora/-/ora-9.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":"20d4bdb708ff6a7d0c1be5ad00194b58a5cdb637","scripts":{"test":"xo && NODE_ENV=test node --test test.js && tsd"},"_npmUser":{"name":"sindresorhus","email":"sindresorhus@gmail.com"},"repository":{"url":"git+https://github.com/sindresorhus/ora.git","type":"git"},"_npmVersion":"10.9.2","description":"Elegant terminal spinner","directories":{},"sideEffects":false,"_nodeVersion":"20.19.5","dependencies":{"chalk":"^5.6.2","cli-cursor":"^5.0.0","strip-ansi":"^7.1.2","log-symbols":"^7.0.1","cli-spinners":"^3.2.0","string-width":"^8.1.0","is-interactive":"^2.0.0","stdin-discarder":"^0.2.2","is-unicode-supported":"^2.1.0"},"_hasShrinkwrap":false,"devDependencies":{"xo":"^1.2.2","ava":"^6.4.1","tsd":"^0.33.0","get-stream":"^9.0.1","@types/node":"^24.5.0","transform-tty":"^1.0.11"},"_npmOperationalInternal":{"tmp":"tmp/ora_9.0.0_1757993420804_0.29394854246644275","host":"s3://npm-registry-packages-npm-production"},"readme":"# ora\n\n> Elegant terminal spinner\n\n<p align=\"center\">\n\t<br>\n\t<img src=\"screenshot.svg\" width=\"500\">\n\t<br>\n</p>\n\n## Install\n\n```sh\nnpm install ora\n```\n\n*Check out [`yocto-spinner`](https://github.com/sindresorhus/yocto-spinner) for a smaller alternative.*\n\n## Usage\n\n```js\nimport ora from 'ora';\n\nconst spinner = ora('Loading unicorns').start();\n\nsetTimeout(() => {\n\tspinner.color = 'yellow';\n\tspinner.text = 'Loading rainbows';\n}, 1000);\n```\n\n## API\n\n### ora(text)\n### ora(options)\n\nIf a string is provided, it is treated as a shortcut for [`options.text`](#text).\n\n#### options\n\nType: `object`\n\n##### text\n\nType: `string`\n\nThe text to display next to the spinner.\n\n##### prefixText\n\nType: `string | () => string`\n\nText or a function that returns text to display before the spinner. No prefix text will be displayed if set to an empty string.\n\n##### suffixText\n\nType: `string | () => string`\n\nText or a function that returns text to display after the spinner text. No suffix text will be displayed if set to an empty string.\n\n##### spinner\n\nType: `string | object`\\\nDefault: `'dots'` <img src=\"screenshot-spinner.gif\" width=\"14\">\n\nThe name of one of the [provided spinners](#spinners). See `example.js` in this repo if you want to test out different spinners. On Windows (except for Windows Terminal), it will always use the `line` spinner as the Windows command-line doesn't have proper Unicode support.\n\nOr an object like:\n\n```js\n{\n\tframes: ['-', '+', '-'],\n\tinterval: 80 // Optional\n}\n```\n\n##### color\n\nType: `string | false`\\\nDefault: `'cyan'`\\\nValues: `'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray' | false`\n\nThe color of the spinner. Set to `false` to disable coloring.\n\n##### hideCursor\n\nType: `boolean`\\\nDefault: `true`\n\nSet to `false` to stop Ora from hiding the cursor.\n\n##### indent\n\nType: `number`\\\nDefault: `0`\n\nIndent the spinner with the given number of spaces.\n\n##### interval\n\nType: `number`\\\nDefault: Provided by the spinner or `100`\n\nInterval between each frame.\n\nSpinners provide their own recommended interval, so you don't really need to specify this.\n\n##### stream\n\nType: `stream.Writable`\\\nDefault: `process.stderr`\n\nStream to write the output.\n\nYou could for example set this to `process.stdout` instead.\n\n##### isEnabled\n\nType: `boolean`\n\nForce enable/disable the spinner. If not specified, the spinner will be enabled if the `stream` is being run inside a TTY context (not spawned or piped) and/or not in a CI environment.\n\nNote that `{isEnabled: false}` doesn't mean it won't output anything. It just means it won't output the spinner, colors, and other ansi escape codes. It will still log text.\n\n##### isSilent\n\nType: `boolean`\\\nDefault: `false`\n\nDisable the spinner and all log text. All output is suppressed and `isEnabled` will be considered `false`.\n\n##### discardStdin\n\nType: `boolean`\\\nDefault: `true`\n\nDiscard stdin input (except Ctrl+C) while running if it's TTY. This prevents the spinner from twitching on input, outputting broken lines on <kbd>Enter</kbd> key presses, and prevents buffering of input while the spinner is running.\n\nThis has no effect on Windows as there is no good way to implement discarding stdin properly there.\n\nNote: `discardStdin` puts stdin into raw mode. In raw mode, `Ctrl+C` no longer generates `SIGINT` from the terminal. Ora re-emits `Ctrl+C` from stdin input, but if your code blocks the event loop with synchronous work, `Ctrl+C` handling is delayed until the blocking work ends. Use async APIs, a worker thread, or a child process to keep `Ctrl+C` responsive, or set `discardStdin` to `false`.\n\n### Instance\n\n#### .text <sup>get/set</sup>\n\nChange the text displayed after the spinner.\n\n#### .prefixText <sup>get/set</sup>\n\nChange the text before the spinner.\n\nNo prefix text will be displayed if set to an empty string.\n\n#### .suffixText <sup>get/set</sup>\n\nChange the text after the spinner text.\n\nNo suffix text will be displayed if set to an empty string.\n\n#### .color <sup>get/set</sup>\n\nChange the spinner color.\n\n#### .spinner <sup>get/set</sup>\n\nChange the spinner.\n\n#### .indent <sup>get/set</sup>\n\nChange the spinner indent.\n\n#### .isSpinning <sup>get</sup>\n\nA boolean indicating whether the instance is currently spinning.\n\n#### .isEnabled <sup>get/set</sup>\n\nA boolean indicating whether the spinner and log text are enabled.\n\n#### .isSilent <sup>get/set</sup>\n\nA boolean indicating whether all output is suppressed.\n\n#### .interval <sup>get</sup>\n\nThe interval between each frame.\n\nThe interval is decided by the chosen spinner.\n\n#### .start(text?)\n\nStart the spinner. Returns the instance. Set the current text if `text` is provided.\n\n#### .stop()\n\nStop and clear the spinner. Returns the instance.\n\n#### .succeed(text?)\n\nStop the spinner, change it to a green `✔` and persist the current text, or `text` if provided. Returns the instance. See the GIF below.\n\n#### .fail(text?)\n\nStop the spinner, change it to a red `✖` and persist the current text, or `text` if provided. Returns the instance. See the GIF below.\n\n#### .warn(text?)\n\nStop the spinner, change it to a yellow `⚠` and persist the current text, or `text` if provided. Returns the instance.\n\n#### .info(text?)\n\nStop the spinner, change it to a blue `ℹ` and persist the current text, or `text` if provided. Returns the instance.\n\n#### .stopAndPersist(options?)\n\nStop the spinner and change the symbol or text. Returns the instance. See the GIF below.\n\n##### options\n\nType: `object`\n\n###### symbol\n\nType: `string`\\\nDefault: `' '`\n\nSymbol to replace the spinner with.\n\n###### text\n\nType: `string`\\\nDefault: Current `'text'`\n\nText to be persisted after the symbol.\n\n###### prefixText\n\nType: `string | () => string`\\\nDefault: Current `prefixText`\n\nText or a function that returns text to be persisted before the symbol. No prefix text will be displayed if set to an empty string.\n\n###### suffixText\n\nType: `string | () => string`\\\nDefault: Current `suffixText`\n\nText or a function that returns text to be persisted after the text after the symbol. No suffix text will be displayed if set to an empty string.\n\n<img src=\"screenshot-2.gif\" width=\"480\">\n\n#### .clear()\n\nClear the spinner. Returns the instance.\n\n#### .render()\n\nManually render a new frame. Returns the instance.\n\n#### .frame()\n\nGet a new frame.\n\n### oraPromise(action, text)\n### oraPromise(action, options)\n\nStarts a spinner for a promise or promise-returning function. The spinner is stopped with `.succeed()` if the promise fulfills or with `.fail()` if it rejects. Returns the promise.\n\n```js\nimport {oraPromise} from 'ora';\n\nawait oraPromise(somePromise);\n```\n\n#### action\n\nType: `Promise | ((spinner: Ora) => Promise)`\n\n#### options\n\nType: `object`\n\nAll of the [options](#options) plus the following:\n\n##### successText\n\nType: `string | ((result: T) => string) | undefined`\n\nThe new text of the spinner when the promise is resolved.\n\nKeeps the existing text if `undefined`.\n\n##### failText\n\nType: `string | ((error: unknown) => string) | undefined`\n\nThe new text of the spinner when the promise is rejected.\n\nKeeps the existing text if `undefined`.\n\n##### successSymbol\n\nType: `string | undefined`\n\nThe symbol to use when the promise is resolved, instead of the default success symbol.\n\nUseful if you want to customize or disable the symbol.\n\nUses the default success symbol if `undefined`.\n\n##### failSymbol\n\nType: `string | undefined`\n\nThe symbol to use when the promise is rejected, instead of the default failure symbol.\n\nUseful if you want to customize or disable the symbol.\n\nUses the default failure symbol if `undefined`.\n\n### spinners\n\nType: `Record<string, Spinner>`\n\nAll [provided spinners](https://github.com/sindresorhus/cli-spinners/blob/main/spinners.json).\n\n## FAQ\n\n### How do I change the color of the text?\n\nUse [`chalk`](https://github.com/chalk/chalk) or [`yoctocolors`](https://github.com/sindresorhus/yoctocolors):\n\n```js\nimport ora from 'ora';\nimport chalk from 'chalk';\n\nconst spinner = ora(`Loading ${chalk.red('unicorns')}`).start();\n```\n\n### Why does the spinner freeze?\n\nJavaScript is single-threaded, so any synchronous operations will block the spinner's animation. To avoid this, prefer using asynchronous operations.\n\n### Why do I get the line spinner on Windows Terminal or WSL?\n\nWindows Terminal does [not expose](https://github.com/microsoft/terminal/issues/1040) a reliable, stable way to detect itself or Unicode support from Node, and `WT_SESSION` is explicitly informative, not a detection API and can be inherited by other terminals. That makes environment-based detection best-effort. If you are in a Unicode-capable terminal, set `spinner` explicitly, for example `ora({spinner: 'dots'})`.\n\n### Can I log messages while the spinner is running?\n\nYes! Ora automatically handles writes to the same stream. The spinner will temporarily clear itself, output your message, and re-render below:\n\n```js\nconst spinner = ora('Processing...').start();\n\nconsole.log('Step 1 complete');\nconsole.log('Step 2 complete');\n\nspinner.succeed('Done!');\n```\n\nThe output will be clean with each log appearing above the spinner. This works seamlessly without requiring any special logging methods. Both `console.log()` (stdout) and `console.error()`/`console.warn()` (stderr) are supported.\n\n> [!NOTE]\n> Don't run multiple spinners concurrently. Use one spinner at a time.\n\n### Can I display multiple spinners simultaneously?\n\nNo. Ora is designed to display a single spinner at a time. For multiple concurrent progress indicators, consider alternatives like [listr2](https://github.com/listr2/listr2) or [spinnies](https://github.com/jcarpanelli/spinnies).\n\n### Can I use Ora with [log-update](https://github.com/sindresorhus/log-update)?\n\nYes, use the `.frame()` method to get the current spinner frame and include it in your log-update output.\n\n### Does Ora work in Node.js Worker threads?\n\nNo. Ora requires an interactive terminal environment and Worker threads are not considered interactive, so the spinner will not animate. Run the spinner in the main thread and control it via worker messages:\n\n```js\n// main.js\nimport {Worker} from 'node:worker_threads';\nimport ora from 'ora';\n\nconst spinner = ora().start();\nconst worker = new Worker('./worker.js');\n\nworker.on('message', message => {\n\tswitch (message.type) {\n\t\tcase 'ora:text':\n\t\t\tspinner.text = message.text;\n\t\t\tbreak;\n\t\tcase 'ora:succeed':\n\t\t\tspinner.succeed(message.text);\n\t\t\tbreak;\n\t\tcase 'ora:fail':\n\t\t\tspinner.fail(message.text);\n\t\t\tbreak;\n\t}\n});\n```\n\n```js\n// worker.js\nimport {parentPort} from 'node:worker_threads';\n\nparentPort.postMessage({type: 'ora:text', text: 'Working...'});\n\n// Do work...\n\nparentPort.postMessage({type: 'ora:succeed', text: 'Done!'});\n```\n\n## Related\n\n- [yocto-spinner](https://github.com/sindresorhus/yocto-spinner) - Tiny terminal spinner\n- [cli-spinners](https://github.com/sindresorhus/cli-spinners) - Spinners for use in the terminal\n\n**Ports**\n\n- [CLISpinner](https://github.com/kiliankoe/CLISpinner) - Terminal spinner library for Swift\n- [halo](https://github.com/ManrajGrover/halo) - Python port\n- [spinners](https://github.com/FGRibreau/spinners) - Terminal spinners for Rust\n- [marquee-ora](https://github.com/joeycozza/marquee-ora) - Scrolling marquee spinner for Ora\n- [briandowns/spinner](https://github.com/briandowns/spinner) - Terminal spinner/progress indicator for Go\n- [tj/go-spin](https://github.com/tj/go-spin) - Terminal spinner package for Go\n- [observablehq.com/@victordidenko/ora](https://observablehq.com/@victordidenko/ora) - Ora port to Observable notebooks\n- [kia](https://github.com/HarryPeach/kia) - Simple terminal spinners for Deno 🦕\n","publish_time":1757993420976,"_cnpm_publish_time":1757993420976,"dist-tags":{"latest":"10.0.0"}}