# stream-line-wrapper

> Wrap each lines of a stream with a prefix, suffix or a custom function.

Latest version **0.1.1** (published 2014-02-10) · MIT license · 0 weekly downloads

## Install

```sh
npm install stream-line-wrapper
pnpm add stream-line-wrapper
yarn add stream-line-wrapper
bun add stream-line-wrapper
```

## Health

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

Positive: has types package; no vulnerabilities; high quality score.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2014-02-10 |
| First published | 2014-02-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/stream-line-wrapper) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | Greg Bergé |
| Maintainers | neoziro |
| Keywords | stream, line, wrapper, suffix, prefix |

## Links

- npm: https://www.npmjs.com/package/stream-line-wrapper
- Repository: https://github.com/neoziro/stream-line-wrapper
- Issues: https://github.com/neoziro/stream-line-wrapper/issues
- npm.io page: https://npm.io/package/stream-line-wrapper

## Dependencies (1)

- [async](https://npm.io/package/async.md) ~0.2.10

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 0.1.1 (latest) — 2014-02-10
- 0.1.0 — 2014-02-09

## README

# Stream line wrapper [![Build Status](https://travis-ci.org/neoziro/stream-line-wrapper.png?branch=master)](https://travis-ci.org/neoziro/stream-line-wrapper)

Wrap each lines of a stream with a prefix, suffix or a custom function.

## Usage

```js
var childProcess = require('child_process');
var LineWrapper = require('stream-line-wrapper');
var ls = childProcess.exec('ls');

var lineWrapper = new LineWrapper({ prefix: '-- ' });
ls.stdout.pipe(lineWrapper).pipe(process.stdout);

// -- file1.js
// -- file2.js
// -- file3.js
```

## Options

### prefix

Prefix each lines with a string.

```js
var lineWrapper = new LineWrapper({ prefix: '-- ' });
ls.stdout.pipe(lineWrapper).pipe(process.stdout);

// -- file1.js
```

### suffix

Suffix each lines with a string.

```js
var lineWrapper = new LineWrapper({ suffix: ' @' });
ls.stdout.pipe(lineWrapper).pipe(process.stdout);

// file1.js @
```

### wrapper

Use a function to wrapper each lines.

```js
var lineWrapper = new LineWrapper({ wrapper: countChars });

/**
 * Prefix each lines with char count.
 *
 * @param {String} line
 * @param {Function} cb
 */

function countChars(line, cb) {
  return cb(null, '(' + line.length + ') ' + line);
}

ls.stdout.pipe(lineWrapper).pipe(process.stdout);

// (8) file1.js
```

## License

MIT

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