# pull-cont

> pull-streams and continuables make friends!

Latest version **0.1.1** (published 2017-04-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install pull-cont
pnpm add pull-cont
yarn add pull-cont
bun add pull-cont
```

## 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.1.1 |
| Published | 2017-04-04 |
| First published | 2016-11-03 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 5 |
| Author | 'Dominic Tarr' |
| Maintainers | dominictarr |

## Links

- npm: https://www.npmjs.com/package/pull-cont
- Repository: https://github.com/dominictarr/pull-cont
- Issues: https://github.com/dominictarr/pull-cont/issues
- npm.io page: https://npm.io/package/pull-cont

## Recent versions

- 0.1.1 (latest) — 2017-04-04
- 0.1.0 — 2017-04-04
- 0.0.0 — 2016-11-03

## README

# pull-cont

pull-streams and continuables make friends!

## continuables

continuables are a like async callbacks, but more composable.
instead of taking a series of arguments, then a callback,
a continuable takes it's arguments, and returns a function
that takes exactly one argument: the callback.

this makes it easy represent a single async operation,
you can easily pass a continuable to another function.

[continuable](https://github.com/raynos/continuable) repo, bundle of best [cont](https://github.com/dominictarr/cont)inuables.

## example

pull-cont takes a continuable that returns a pull-stream, and makes it into a pull-stream.

It's like [pull-defer](https://github.com/pull-stream/pull-defer) but easier for simple cases.

``` js
var PullCont = require('pull-cont')
// or PullCont = requrie('pull-cont/source')

//create a pull-stream that reads a directory!
pull(
  PullCont(function (cb) {
    fs.readdir(directory, function (err, ls) {
      if(err) cb(err)
      else cb(null, pull.values(ls))
    })
  }),
  ...
)
```

for Source streams, if the continuable returns _another_ continuable, `pull-cont` will also call that recursively
until it gets a `pull-stream` source. I don't know, this might be useful for something.

## Sink & Duplex

You can also use this to create sink and duplex streams.
(Unless you are designing a protocol you can probably ignore Duplex)

``` js
var Sink = require('pull-cont/sink')
var Duplex = require('pull-cont/duplex')

//and then complete the continuable with the correct type of stream
Sink(function (cb) {
  cb(null, pull.drain())
})
```



## License

MIT

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