# readline-browserify

> Readline implementation for browserify.

Latest version **0.0.4** (published 2012-08-23) · 0 weekly downloads

## Install

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

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; low quality score; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.4 |
| Published | 2012-08-23 |
| First published | 2012-06-19 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Author | Joe Ferner |
| Maintainers | joeferner |
| Keywords | browserify, readline |

## Links

- npm: https://www.npmjs.com/package/readline-browserify
- Repository: https://github.com/nearinfinity/node-readline-browserify
- npm.io page: https://npm.io/package/readline-browserify

## Alternatives

- [@opentelemetry/exporter-zipkin](https://npm.io/package/@opentelemetry/exporter-zipkin.md) — 14.8M weekly downloads
- [pusher-js](https://npm.io/package/pusher-js.md) — 2.0M weekly downloads
- [browserify](https://npm.io/package/browserify.md) — 1.7M weekly downloads
- [sqs-consumer](https://npm.io/package/sqs-consumer.md) — 1.7M weekly downloads
- [@sanity/eventsource](https://npm.io/package/@sanity/eventsource.md) — 930.8K weekly downloads

## Recent versions

- 0.0.4 (latest) — 2012-08-23
- 0.0.3 — 2012-07-23
- 0.0.2 — 2012-06-20
- 0.0.1 — 2012-06-19

## README

# readline-browserify

Readline implementation for browserify.

# Install

```bash
npm install browserify
npm install readline-browserify
```

# Usage

Copy the css from default.css into your css file.

```html
<div id="commandLineOutput"></div>
<div id="commandLine"></div>

<script>
  var readline = require("readline");

  var rl = readline.createInterface({
    elementId: 'commandLine',

    write: function(data) {
      var output = document.getElementById('commandLineOutput');
      if (output.innerHTML.length > 0) {
        output.innerHTML += "<br>";
      }
      output.innerHTML += line;
    },

    completer: function(linePartial, callback) {
      var cmds = ['command1', 'command2', 'test'];
      var matches = [];
      cmds.forEach(function (cmd) {
        if (cmd.indexOf(linePartial) === 0) {
          matches.push(cmd);
        }
      });
      callback(null, [matches, linePartial]);
    }
  });

  rl.setPrompt('browserify> ');
  rl.prompt();
  rl.on('line', function (line) {
      switch (line.trim()) {
      case 'command1':
        rl.write('ok command1');
        break;
      case 'command2':
        rl.write('ok command2');
        break;
      case 'test':
        rl.write('ok test');
        break;
      default:
        rl.write('Say what? I might have heard `' + line.trim() + '`');
        break;
      }
      rl.prompt();
    });
</script>
```

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