# readline-history

> Adds support for saving history to a file, and loading it next time automatically.

Latest version **1.2.0** (published 2013-08-30) · WTFPL license · 0 weekly downloads

## Install

```sh
npm install readline-history
pnpm add readline-history
yarn add readline-history
bun add readline-history
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2013-08-30 |
| First published | 2013-08-30 |
| Weekly downloads | 0 |
| License | WTFPL |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | cy1 |

## Links

- npm: https://www.npmjs.com/package/readline-history
- npm.io page: https://npm.io/package/readline-history

## Recent versions

- 1.2.0 (latest) — 2013-08-30
- 1.1.0 — 2013-08-30
- 1.0.1 — 2013-08-30
- 1.0.0 — 2013-08-30

## README

/* Monkey-patching history support into readline.
 * Usage: createInterface is like readline's createInterface, but also takes a path and 
 * a maximum (in-memory) history length. Also it's async, so use CPS.
 *
 * maxDiskSize is maximum bytes that can go in disk history
 * before a rotation. Rotation is super simple, removes previous .old, renames to .old
 *
 * console.log(module.example) to see an example of how to use.
 */

var rl = require('readline-history');
rl.createInterface({
    path: "/tmp/history",
    maxLength: 1234,
    input: process.input,
    output: process.output,
    next: function(rli) {
        rli.setPrompt("? ");
        rli.prompt();
        rli.on('line',function(line) {
            console.log("Got line "+line);
            rli.prompt();
        });
    };
});

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