An open API service indexing awesome lists of open source software.

https://github.com/43081j/fast-wrap-ansi

A tiny and fast library for word wrapping terminal output.
https://github.com/43081j/fast-wrap-ansi

Last synced: 8 months ago
JSON representation

A tiny and fast library for word wrapping terminal output.

Awesome Lists containing this project

README

          

# fast-wrap-ansi

Wordwrap a string, taking ANSI escape codes into account.

A fast, light fork of the `wrap-ansi` package.

## Install

```bash
npm i -S fast-wrap-ansi
```

## Usage

```ts
import {wrapAnsi} from 'fast-wrap-ansi';

const str = 'This is a string with some \x1b[31mANSI\x1b[39m codes.';
const wrapped = wrapAnsi(str, 20);
console.log(wrapped);
```

## License

MIT