# d-ashesss-console

> Node.js interface to linux console advanced features

Latest version **0.1.0** (published 2015-06-23) · MIT license · 0 weekly downloads

## Install

```sh
npm install d-ashesss-console
pnpm add d-ashesss-console
yarn add d-ashesss-console
bun add d-ashesss-console
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.0 |
| Published | 2015-06-23 |
| First published | 2015-06-23 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Sergey Mashentsev |
| Maintainers | d-ashesss |
| Keywords | console, terminal |

## Links

- npm: https://www.npmjs.com/package/d-ashesss-console
- Repository: https://github.com/d-ashesss/node-console
- Issues: https://github.com/d-ashesss/node-console/issues
- npm.io page: https://npm.io/package/d-ashesss-console

## Dependencies (1)

- [sprintf-js](https://npm.io/package/sprintf-js.md) ^1.0

## Alternatives

- [localforage](https://npm.io/package/localforage.md) — 6.2M weekly downloads
- [localforage-observable](https://npm.io/package/localforage-observable.md) — 30.8K weekly downloads
- [@y/y](https://npm.io/package/@y/y.md) — 30.1K weekly downloads
- [@metaobjectsdev/render](https://npm.io/package/@metaobjectsdev/render.md) — 3.5K weekly downloads
- [@ledgerhq/coin-algorand](https://npm.io/package/@ledgerhq/coin-algorand.md) — 1.1K weekly downloads

## Recent versions

- 0.1.0 (latest) — 2015-06-23

## README

# Console
Provides interface to linux console advanced features.

## Install via npm
```bash
npm install d-ashesss-console
```

## Demo
To watch a demonstration run `bin/demo`

## Usage
### Console
```js
require("d-ashesss-console");
```

Package will include its features into global console object.

**Console::reset()** - Resets the terminal to initial state
```js
console.reset;
```

**Console::write()** - Writes to stdout without trailing newline
```js
console.write("Hello World!");
```

### Cursor
```js
console.write("OOOOO\nOOOOO\nOOOOO\n");
```

**Cursor::moveUp()** - Moves cursor N lines up
```js
console.cursor.moveUp(3);
console.write("X");
```
```
XOOOO
OOOOO
OOOOO
```

**Cursor::moveDown()** - Moves cursor N lines down
```js
console.cursor.moveDown(2);
console.write("X");
```
```
xOOOO
OOOOO
OXOOO
```

**Cursor::moveRight()** - Moves cursor N characters right
```js
console.cursor.moveRight(2);
console.write("X");
```
```
xOOOO
OOOOO
OxOOX
```

**Cursor::moveLeft()** - Moves cursor N characters left
```js
console.cursor.moveLeft(2);
console.write("X");
```
```
xOOOO
OOOOO
OxOXx
```

**Cursor::move()** - Moves cursor by X:Y
```js
console.cursor.move(-3, -1);
console.write("X");
```
```
xOOOO
OXOOO
OxOxx
```

**Cursor::moveTo()** - Moves cursor to X:Y position on screen
```js
console.cursor.moveTo(3, 0);
console.write("X");
```
```
xOOXO
OxOOO
OxOxx
```

**Cursor::save()** - Saves cursor position and attributes. Only one position can be saved at a time: each time you call save() it overrides previously saved position.

**Cursor::restore()** - Restores cursor position and attributes

```js
console.write("OOOOO\nOO");
console.cursor.save();
console.write("OOO\nOOOOO\n");
console.cursor.restore();
console.write("X");
```
```
OOOOO
OOXOO
OOOOO
```

### Screen
**Screen::init()** - Saves current screen and created new empty session. Behavior is similar to such applications as Vim or Less.

**Screen::restore()** - Restores screen saved by **Screen::init()**

**Screen::clearUp()** - Clears screen up from cursor, including line to the left of cursor
```js
console.write("OOOOO\nOOOOO\nOOOOO\n");
console.cursor.moveTo(2, 1);
console.screen.clearUp();
```
```
.....
...OO
OOOOO
```

**Screen::clearDown()** - Clears screen down from cursor, including line to the right of cursor
```js
console.write("OOOOO\nOOOOO\nOOOOO\n");
console.cursor.moveTo(2, 1);
console.screen.clearDown();
```
```
OOOOO
OO...
.....
```

**Screen::clearLeft()** - Clears line to the left of cursor, including cursor position
```js
console.write("OOOOO\nOOOOO\nOOOOO\n");
console.cursor.moveTo(2, 1);
console.screen.clearLeft();
```
```
OOOOO
...OO
OOOOO
```

**Screen::clearRight()** - Clears line to the right of cursor, including cursor position
```js
console.write("OOOOO\nOOOOO\nOOOOO\n");
console.cursor.moveTo(2, 1);
console.screen.clearRight();
```
```
OOOOO
OO...
OOOOO
```

**Screen::clearLine()** - Clears entire line and moves cursor to the beginning of the line
```js
console.write("OOOOO\nOOOOO\nOOOOO\n");
console.cursor.moveTo(2, 1);
console.screen.clearLine();
console.write("X");
```
```
OOOOO
X....
OOOOO
```

**Screen::clear()** - Clears entire screen and moves cursor to upper left corner

---
_Source: https://npm.io/package/d-ashesss-console · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
