Node bindings for Rust's crossterm
$ npm install node-crossterm
const crossterm = require("node-crossterm");
crossterm.clear(crossterm.ClearType.All);
crossterm.goto(13, 37);
crossterm.pos();
All methods of Terminal and TerminalCursor are available as methods on the default export.
Other features of crossterm
like AlternateScreen and Screen are not available in this library (yet).
Get the terminal cursor position.
Returns object with x
and y
properties.
Set terminal cursor position.
Move the terminal cursor by n
in direction specified by function name.
Save the terminal cursor position.
Restore the terminal cursor position.
Hide the terminal cursor.
Show the terminal cursor.
Set cursor blink on or off.
JavaScript equivalent of crossterm ClearType enum.
{
All,
FromCursorDown,
FromCursorUp,
CurrentLine,
UntilNewLine
}
Clear the terminal according to the given clear_type
.
// Example: clear all lines of the terminal
crossterm.clear(crossterm.ClearType.All);
Get the terminal size.
Returns object with width
and height
properties.
Scroll the terminal up n
rows.
Scroll the terminal down n
rows.
Set the terminal width and height.
Exit the current process.
Write a string to the terminal.
From the crossterm docs:
- Windows Powershell
- Windows 10 (pro)
- Windows CMD
- Windows 10 (pro)
- Windows 8.1 (N)
- Ubuntu Desktop Terminal
- Ubuntu 17.10
- (Arch, Manjaro) KDE Konsole
- Linux Mint
MIT © Sam Gluck