# @streamyflow/terminal

> Basic terminal functions

Latest version **1.0.0** (published 2023-09-23) · ISC license · 0 weekly downloads

## Install

```sh
npm install @streamyflow/terminal
pnpm add @streamyflow/terminal
yarn add @streamyflow/terminal
bun add @streamyflow/terminal
```

## Health

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

Positive: esm support; no vulnerabilities.

Warnings: low downloads; no types.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2023-09-23 |
| First published | 2023-09-23 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | streamyflow |
| Keywords | cli, terminal |

## Links

- npm: https://www.npmjs.com/package/@streamyflow/terminal
- npm.io page: https://npm.io/package/@streamyflow/terminal

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2023-09-23

## README

# Introduction

This is a small module to provide some basic terminal related operations to help build better CLI tools.

# Functions

## Text Layout to Fit the Width of the Terminal

Basic usage:

```
import terminal from "@streamyflow/terminal"

const paragraph = `As an asynchronous event-driven JavaScript runtime,
    Node.js is designed to build scalable network applications.
    In the following "hello world" example, many connections can be handled concurrently.
    Upon each connection, the callback is fired, but if there is no work to be done,
    Node.js will sleep.`

const formatted = terminal.layout(paragraph, '\n', 60)
console.log('-'.repeat(60))
console.log(formatted)
console.log('-'.repeat(60))
```

This produces

```
------------------------------------------------------------
As an asynchronous event-driven JavaScript runtime, Node.js
is designed to build scalable network applications. In the
following "hello world" example, many connections can be
handled concurrently. Upon each connection, the callback is
fired, but if there is no work to be done, Node.js will
sleep.
------------------------------------------------------------
```

## Prompt for a Password

Basic usage:

```
import terminal from "@streamyflow/terminal"

const password = await terminal.prompt("Password: ")
console.log(password)

// alternatively
terminal.prompt("Secret: ").then(secret => console.log(secret))
```

This function properly handles CR, LF, Ctrl-D as input terminators, and propagates Ctrl-C as a SIGINT to the
process itself.

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