restore-cursor
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
onetime | 5.1.2 | 2.68 kB | MIT | prod | |
signal-exit | 3.0.7 | 3.76 kB | ISC | prod |
Restore-cursor is a helpful JavaScript tool primarily designed for use in the Command Line Interface (CLI). Its main function is to gracefully restore the CLI cursor upon exit. This restoration becomes instrumental especially when a process crashes while the cursor is hidden — instead of keeping the cursor invisibly hidden, restore-cursor intervenes to bring it back. However, it's important to note that restore-cursor won't perform any action if run in a non-TTY context.
To use restore-cursor, you will first need to install the package. The package can be installed using npm with the following command:
npm install restore-cursor
Once the package is successfully installed, you can import it and use it in your JavaScript file as shown below:
import restoreCursor from 'restore-cursor';
restoreCursor();
In this example, restoreCursor()
is called without any argument. This function call ensures that the CLI cursor is restored upon the exit of the current process.
You can refer to the restore-cursor documentation on the repository's page available on GitHub: github.com/sindresorhus/restore-cursor. The README file contains essential information about the package, from installation guide to basic usage examples.