# single-line-log

> Keep writing to the same line in the terminal. Very useful when you write progress bars, or a status message during longer operations

Latest version **1.1.2** (published 2016-09-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install single-line-log
pnpm add single-line-log
yarn add single-line-log
bun add single-line-log
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2016-09-09 |
| First published | 2013-09-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | separate (@types/single-line-log) |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 208 |
| Author | Tobias Baunbæk |
| Maintainers | freeall, mafintosh |
| Keywords | single, line, log, output, overwrite, collapse, stdout, terminal, tty, cli, shell |

## Links

- npm: https://www.npmjs.com/package/single-line-log
- Repository: https://github.com/freeall/single-line-log
- Homepage: https://github.com/freeall/single-line-log#readme
- Issues: https://github.com/freeall/single-line-log/issues
- npm.io page: https://npm.io/package/single-line-log

## Dependencies (1)

- [string-width](https://npm.io/package/string-width.md) ^1.0.1

## 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.1.2 (latest) — 2016-09-09
- 1.1.1 — 2016-02-28
- 1.1.0 — 2016-02-27
- 1.0.1 — 2015-11-04
- 1.0.0 — 2015-05-24
- 0.4.1 — 2014-05-31
- 0.4.0 — 2014-05-10
- 0.3.1 — 2013-12-26
- 0.3.0 — 2013-12-25
- 0.2.0 — 2013-12-11
- 0.1.2 — 2013-11-13
- 0.1.1 — 2013-11-13
- 0.1.0 — 2013-09-11

## README

# single-line-log

Node.js module that keeps writing to the same line in the console (or a stream). Very useful when you write progress bars, or a status message during longer operations. Supports multilines.


## Installation

	npm install single-line-log


## Usage

``` js
var log = require('single-line-log').stdout;
// or pass any stream:
// var log = require('single-line-log')(process.stdout);

var read = 0;
var size = fs.statSync('super-large-file').size;

var rs = fs.createReadStream('super-large-file');
rs.on('data', function(data) {
	read += data.length;
	var percentage = Math.floor(100*read/size);

	// Keep writing to the same two lines in the console
	log('Writing to super large file\n[' + percentage + '%]', read, 'bytes read');
});
```

## .clear()

Clears the log (i.e., writes a newline).

``` js
var log = require('single-line-log').stdout;

log('Line 1');
log.clear();
log('Line 2');
```


## .stdout

Outputs to `process.stdout`.


## .stderr

Outputs to `process.stderr`.


## License

MIT

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