# hypernal

> Renders terminal output as html to simplify reusing server side modules in the browser.

Latest version **0.3.0** (published 2015-04-21) · MIT license · 0 weekly downloads

## Install

```sh
npm install hypernal
pnpm add hypernal
yarn add hypernal
bun add hypernal
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.3.0 |
| Published | 2015-04-21 |
| First published | 2013-04-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 66 |
| Author | Thorsten Lorenz |
| Maintainers | thlorenz |
| Keywords | terminal, render, browser, ansi, colors |

## Links

- npm: https://www.npmjs.com/package/hypernal
- Repository: https://github.com/thlorenz/hypernal
- Issues: https://github.com/thlorenz/hypernal/issues
- npm.io page: https://npm.io/package/hypernal

## Dependencies (1)

- [through](https://npm.io/package/through.md) ~2.3.4

## 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.3.0 (latest) — 2015-04-21
- 0.2.7 — 2013-08-02
- 0.2.6 — 2013-07-08
- 0.2.5 — 2013-07-08
- 0.2.4 — 2013-06-26
- 0.2.3 — 2013-05-16
- 0.2.2 — 2013-05-10
- 0.2.1 — 2013-05-01
- 0.2.0 — 2013-05-01
- 0.1.3 — 2013-04-19
- 0.1.2 — 2013-04-14
- 0.1.1 — 2013-04-06
- 0.1.0 — 2013-04-04

## README

# hypernal

Renders terminal output as html to simplify reusing server side modules in the browser.

## Example

**main.js**
```js
var term = require('hypernal')();
term.appendTo('#terminal');

var difflet = require('difflet')({
      indent : 2 
    , comma : 'first'
    , comment: true
    });

var diff = difflet.compare({ a : [1, 2, 3 ], c : 5 }, { a : [1, 2, 3, 4 ], b : 4 });
term.write(diff);
```

**browserify-build.js**
```js
require('browserify')()
  .require(require.resolve('./main.js'), { entry: true })
  .bundle()
  .pipe(require('fs').createWriteStream(__dirname + '/bundle.js'), 'utf-8');
```

**index.html**
```html
<body>
  <div id="terminal"></div>
  <script type="text/javascript" src="./bundle.js"></script>
</body>
```

**index.css**
```css
#terminal {
  width         :  600px;
  height        :  400px;
  background    :  black;
  padding       :  15px 20px 15px 20px;
  border-radius :  15px;
  border        :  2px solid #CEE1F0;
  font-family   :  Monaco;
  font-size     :  16px;
}
```

![difflet.png](https://github.com/thlorenz/hypernal/raw/master/assets/difflet.png)

View [more complete example](http://thlorenz.github.com/hypernal/) and its [source](https://github.com/thlorenz/hypernal/tree/master/example)

## Installation

    npm install hypernal

## Demo

    npm explore hypernal && npm run demo

## API

***hypernal(options:Object)***

creates a **render only** terminal and returns an interface to interact with it as described below.

**options**:
- allow overriding `{ cols: Number, rows: Number }` of the terminal, which generally is not necessary
**Note:**
  - number of cols will be applied to any row
  - number of rows will indicate how many rows to add initially, but more will be added if needed

***term.tail:Boolean***

- when set to true, the terminal will automatically scroll to the bottom when more lines are added than fit in its
  container

***term.appendTo(elem:String|Object)***

appends the terminal to the given DOM element.

***term.write(s:String)***

writes the given string to the terminal.

***term.writeln(s:String)***

writes the given string to the terminal and adds a line break.

***term.reset()***

clears the terminal

## Kudos

hypernal is basically a trimmed down version of [tty.js](https://github.com/chjj/tty.js/) focused on and improved for rendering only.

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