# suckle

> Stream multiplexer, with callback ability

Latest version **0.5.4** (published 2013-01-05) · 0 weekly downloads

## Install

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

## 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.5.4 |
| Published | 2013-01-05 |
| First published | 2012-05-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >= 0.5.0 |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Weltschmerz |
| Maintainers | Weltschmerz |
| Keywords | stream, multiplex |

## Links

- npm: https://www.npmjs.com/package/suckle
- Repository: https://github.com/Weltschmerz/Suckle
- npm.io page: https://npm.io/package/suckle

## 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

- 0.5.4 (latest) — 2013-01-05
- 0.5.3 — 2012-10-14
- 0.5.2 — 2012-10-11
- 0.5.0 — 2012-09-29
- 0.4.0 — 2012-09-22
- 0.3.0 — 2012-07-21
- 0.2.0 — 2012-07-19
- 0.1.0 — 2012-05-25

## README

## Suckle

`npm install suckle`

Suckle is a stream multiplexer for node. Give it one readable stream, and it pipes to multiple writable streams.

```js
var suckle = require('suckle')

var mux = suckle.createStream();

mux.pipe(process.stdout, process.stdout, process.stdout)
mux.pipe(process.stdout, process.stdout);
mux.pipe(process.stdout);

process.stdin.pipe(mux)
```

The main problem Suckle solves is when you need a callback, to return the piped data. As a case study, say you have a static file server. Ideally, you would like to pipe node's file readStream to gzip, and then to the client. Fine. But what if you also need to cache that gzipped data in an object, for subsequent requests? With Suckle you can!

```js

var fs   = require('fs')
var zlib = require('zlib')
var http = require('http')

var Suckle = require('suckle')

http.createserver(function(req, res) {

    var mux = new Suckle;

    mux.pipe(res);

    mux.onComplete(function(data, length) {
      /* Here's your gzipped data */
    });

    fs.createReadStream('somefile.jpg')
    .pipe(zlib.createGzip())
    .pipe(mux);

}).listen(8080)


```

*Suckle is used internally by [Lactate](https://github.com/Weltschmerz/Lactate)*

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