# epipebomb

> Destroy EPIPE errors when stdout runs through a truncated pipe

Latest version **1.0.0** (published 2016-10-12) · 0 weekly downloads

## Install

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

Provides the command `epipebomb`.

## 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.0.0 |
| Published | 2016-10-12 |
| First published | 2012-05-03 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 66 |
| Author | Michael Hart |
| Maintainers | hichaelmart |

## Links

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

## Recent versions

- 1.0.0 (latest) — 2016-10-12
- 0.1.1 — 2012-08-18
- 0.1.0 — 2012-06-15
- 0.0.1 — 2012-05-03

## README

# EPIPE Bomb

By default, node throws `EPIPE` errors if `process.stdout` is being written to and
a user runs it through a pipe that gets closed while the process is still outputting
(eg, the simple case of piping a node app through `head`).

This seemed a little overzealous to me, so I wrote this to suppress such errors.

## Before

#### example.js
```javascript
;(function log() {
  console.log('tick')
  process.nextTick(log)
})()
```

#### Oh the humanity

```shell
$ node example.js | head
tick
tick
tick
tick
tick
tick
tick
tick
tick
tick

events.js:66
        throw arguments[1]; // Unhandled 'error' event
                       ^
Error: write EPIPE
    at errnoException (net.js:782:11)
    at Object.afterWrite (net.js:600:19)
```

## After

#### example.js
```javascript
require('epipebomb')()

;(function log() {
  console.log('tick')
  process.nextTick(log)
})()
```

#### Oh the joy!
```shell
$ node example.js | head
tick
tick
tick
tick
tick
tick
tick
tick
tick
tick
```

## CLI usage (Node 4.x and up)

Require `epipebomb/register` from the command line

```shell
node -r epipebomb/register some-script.js | head
```

or use `epipebomb` as a drop-in replacement for `node`

```shell
epipebomb some-script.js | head
```

## Notes

Only the `EPIPE` error is captured on `process.stdout` - all other errors are thrown as per usual.

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