https://github.com/sergeysova/alternate-screen
Show alternate terminal screen
https://github.com/sergeysova/alternate-screen
javascript nodejs pty screen terminal tput tty xterm
Last synced: about 1 month ago
JSON representation
Show alternate terminal screen
- Host: GitHub
- URL: https://github.com/sergeysova/alternate-screen
- Owner: sergeysova
- License: mit
- Created: 2017-08-04T10:07:41.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2017-08-04T10:55:36.000Z (almost 8 years ago)
- Last Synced: 2025-05-05T18:38:12.349Z (about 1 month ago)
- Topics: javascript, nodejs, pty, screen, terminal, tput, tty, xterm
- Language: JavaScript
- Homepage: https://npmjs.com/alternate-screen
- Size: 3.91 KB
- Stars: 5
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# alternate-screen
Utility to switch terminal screens. [Read question on SO](https://stackoverflow.com/questions/11023929/using-the-alternate-screen-in-a-bash-script)
## Installation
```bash
npm install --save alternate-screen
```### Usage
Node.JS:
```js
const { show, hide } = require('alternate-screen')console.log('In the main screen')
show()
console.log('In alternate screen')
hide()
console.log('Again in main screen')
```Babel:
```js
import { show, hide } from 'alternate-screen'console.log('In the main screen')
show()
console.log('In alternate screen')
hide()
console.log('Again in main screen')
```### API
#### `show` and `showAlternateScreen`
Write to terminale escape sequence to switch screen to alternate.
#### `hide` and `hideAlternateScreen`
Write to terminale escape sequence to switch screen back to main.
### Example
Clone repository and run:
```bash
node ./test.js
```### License
MIT @ Sergey Sova