# size-limit-stream

> a through stream that destroys itself if an overall size limit for the combined stream throughput is exceeded

Latest version **1.0.0** (published 2015-03-27) · BSD license · 0 weekly downloads

## Install

```sh
npm install size-limit-stream
pnpm add size-limit-stream
yarn add size-limit-stream
bun add size-limit-stream
```

## 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 | 2015-03-27 |
| First published | 2015-03-27 |
| Weekly downloads | 0 |
| License | BSD |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 11 |
| Author | max ogden |
| Maintainers | maxogden |
| Keywords | stream, streams2, through2 |

## Links

- npm: https://www.npmjs.com/package/size-limit-stream
- Repository: https://github.com/maxogden/size-limit-stream
- Issues: https://github.com/maxogden/size-limit-stream/issues
- npm.io page: https://npm.io/package/size-limit-stream

## Dependencies (1)

- [through2](https://npm.io/package/through2.md) ^0.6.3

## Alternatives

- [byte-size](https://npm.io/package/byte-size.md) — 2.1M weekly downloads
- [speed-limiter](https://npm.io/package/speed-limiter.md) — 16.0K weekly downloads
- [@powersync/node](https://npm.io/package/@powersync/node.md) — 10.9K weekly downloads
- [@ledgerhq/coin-cardano](https://npm.io/package/@ledgerhq/coin-cardano.md) — 1.0K weekly downloads
- [@jayesol/jayeson.lib.streamfinder](https://npm.io/package/@jayesol/jayeson.lib.streamfinder.md) — 1.0K weekly downloads

## Recent versions

- 1.0.0 (latest) — 2015-03-27

## README

# size-limit-stream

[![NPM](https://nodei.co/npm/size-limit-stream.png)](https://nodei.co/npm/size-limit-stream/)

[![js-standard-style](https://raw.githubusercontent.com/feross/standard/master/badge.png)](https://github.com/feross/standard)

[![Build Status](https://travis-ci.org/maxogden/size-limit-stream.svg?branch=master)](https://travis-ci.org/maxogden/size-limit-stream)

a through stream that destroys itself if an overall size limit for the combined stream throughput is exceeded. useful for e.g. limiting HTTP upload size

## usage

### `limitStream(limit)`

returns a through stream

example:

```js
var limiter = limitStream(1024 * 5) // 5kb max
```

## example

create a stream that concatenates input, but only if input is less than the limit:

```
var pumpify = require('pumpify')
var concat = require('concat-stream')
var limitStream = require('size-limit-stream')

function uploadStream (cb) {
  var limiter = limitStream(1024 * 5) // 5kb max
  var concatter = concat(function concatted (buff) {
    cb(null, buff)
  })

  var combined = pumpify(limiter, concatter)
  combined.on('error', cb)
  
  return combined
}
```

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