# termios

> get and set terminal attributes, line control, get and set baud rate

Latest version **0.1.8** (published 2018-12-16) · MIT license · 0 weekly downloads

## Install

```sh
npm install termios
pnpm add termios
yarn add termios
bun add termios
```

## 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.8 |
| Published | 2018-12-16 |
| First published | 2015-12-02 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 2 |
| Unpacked size | 12.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | yes |
| GitHub stars | 7 |
| Author | Enno Boland |
| Maintainers | gottox |
| Keywords | tcgetattr, tcsetattr, tty, terminal |

## Links

- npm: https://www.npmjs.com/package/termios
- Repository: https://github.com/Gottox/node-termios
- Issues: https://github.com/Gottox/node-termios/issues
- npm.io page: https://npm.io/package/termios

## Dependencies (2)

- [nan](https://npm.io/package/nan.md) ^2.12.0
- [extend](https://npm.io/package/extend.md) ^3.0.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.8 (latest) — 2018-12-16
- 0.1.7 — 2018-12-16
- 0.1.6 — 2017-03-06
- 0.1.5 — 2017-02-15
- 0.1.4 — 2017-02-06
- 0.1.3 — 2017-01-18
- 0.1.2 — 2016-09-23
- 0.1.1 — 2015-12-29
- 0.1.0 — 2015-12-02

## README

[![Build Status](https://travis-ci.org/Gottox/node-termios.png)](https://travis-ci.org/Gottox/node-termios)

termios bindings for node.js
============================

node-termios is a module for getting and setting terminal attributes.

API
---


* an `attr` object may contain on or more of the following boolean fields:
  * `attr.iflag`: 
    * `IGNBRK`: ignore BREAK condition
    * `BRKINT`: map BREAK to SIGINT
    * `IGNPAR`: ignore (discard) parity errors
    * `PARMRK`: mark parity and framing errors
    * `INPCK`: enable checking of parity errors
    * `ISTRIP`: strip 8th bit off chars
    * `INLCR`: map NL into CR
    * `IGNCR`: ignore CR
    * `ICRNL`: map CR to NL (ala CRMOD)
    * `IXON`: enable output flow control
    * `IXOFF`: enable input flow control
    * `IXANY`: any char will restart after stop
    * `IMAXBEL`: ring bell on input queue full
  * `attr.oflag`: 
    * `OPOST`: enable following output processing
    * `ONLCR`: map NL to CR-NL (ala CRMOD)
    * `OCRNL`: map CR to NL
    * `ONOCR`: No CR output at column 0
    * `ONLRET`: NL performs the CR function
  * `attr.cflag`: 
    * `CSIZE`: character size mask
    * `CS5`: 5 bits (pseudo)
    * `CS6`: 6 bits
    * `CS7`: 7 bits
    * `CS8`: 8 bits
    * `CSTOPB`: send 2 stop bits
    * `CREAD`: enable receiver
    * `PARENB`: parity enable
    * `PARODD`: odd parity, else even
    * `HUPCL`: hang up on last close
    * `CLOCAL`: ignore modem status lines
  * `attr.lflag`: 
    * `ECHOKE`: visual erase for line kill
    * `ECHOE`: visually erase chars
    * `ECHOK`: echo NL after line kill
    * `ECHO`: enable echoing
    * `ECHONL`: echo NL even if ECHO is off
    * `ECHOPRT`: visual erase mode for hardcopy
    * `ECHOCTL`: echo control chars as ^(Char)
    * `ISIG`: enable signals INTR, QUIT, [D]SUSP
    * `ICANON`: canonicalize input lines
    * `IEXTEN`: enable DISCARD and LNEXT
    * `EXTPROC`: external processing
    * `TOSTOP`: stop background jobs from output
    * `FLUSHO`: output being flushed (state)
    * `PENDIN`: XXX retype pending input (state)
    * `NOFLSH`: don't flush after interrupt
    * `XCASE`: canonical upper/lower case

* `.setattr(fd, attr)`: Sets attributes of the terminal bound to the
  file descriptor:
  * fd: file descriptor
  * attr: object as described above
  * returns: undefined

* `.getattr(fd)`: Returns an object describing the current settings
  of the terminal bound to the file descriptor:
  * fd: file descriptor

Examples
--------

```
var termios = require('termios'), data = '';
console.log("Please type something:");
process.stdin.on("data", function(d) {data += d.toString()});
setTimeout(function() {
	console.log("Disabling ECHO. You won't see what you type now");
	termios.setattr(process.stdin.fd, {lflag: { ECHO: false }})
	console.log("\nYou typed '"+data+"'");
	data = "";
}, 3000);
setTimeout(function() {
	console.log("Enabling ECHO.");
	termios.setattr(process.stdin.fd, {lflag: { ECHO: false }})
	console.log("\nYou typed '"+data+"'");
}, 6000);
```

Changelog
---------

* v0.1 - initial release

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