# sentinal-stream

> A transform stream which segregates a sentinel value into its own 'data' event.

Latest version **0.2.3** (published 2014-02-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install sentinal-stream
pnpm add sentinal-stream
yarn add sentinal-stream
bun add sentinal-stream
```

## 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.2.3 |
| Published | 2014-02-07 |
| First published | 2013-09-01 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Andrew Winterman |
| Maintainers | andrewwinterman |
| Keywords | sentinel, split, stream, flow, control |

## Links

- npm: https://www.npmjs.com/package/sentinal-stream
- Repository: https://github.com/AWinterman/sentinal-stream
- Issues: https://github.com/AWinterman/sentinal-stream/issues
- npm.io page: https://npm.io/package/sentinal-stream

## Dependencies (1)

- [index-of-js](https://npm.io/package/index-of-js.md) ~1.0.0

## 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.2.3 (latest) — 2014-02-07
- 0.2.2 — 2013-09-08
- 0.2.1 — 2013-09-07
- 0.2.0 — 2013-09-03
- 0.1.2 — 2013-09-01
- 0.1.1 — 2013-09-01
- 0.1.0 — 2013-09-01

## README

# Sentinal-Stream #

A transform stream that finds a sentinal value in a data stream, and then emits it as a seperate data event.

## Application ##
Any time you want to take a particular action if a certain value appears in a stream, e.g. splitting a stream, stopping a stream early, etc.

## API ##

`sentinal = new Sentinal(sep) ` returns a [transform
stream](http://nodejs.org/api/stream.html#stream_class_stream_transform).
`sep` is a buffered string. It will be stored on `sentinal.seperator`.

# Example #

```javascript
var Sentinal = require('sentinal-stream')
  , through = require('through') // npm.im/through
  , from = require('from') // npm.im/from
  , sentence = ''

var periods = new Sentinal(new Buffer('|||'))

var source = from([
    '||| is the delimiter.'
  , ' Sometimes it fits|||'
  , 'Sometimes it might take'
  , 'more than one line|||'
  , 'Look||| two per chunk|||'
  , '||| or ||| even ||| three!'
  , 'And sometimes only part ||'
  , '| Of the separator fits.'
])

var gather_wipe = through(function(data) {
  if(data === periods.seperator) {
    sentence && console.log(sentence + '.')
    sentence = ''
    return
  }
  sentence += data 
})

source
  .pipe(periods)
  .pipe(gather_wipe) 


```
Yields:

```
is the delimiter. Sometimes it fits.
Sometimes it might take more than one line.
Look. two per chunk.
or even three! And sometimes only part .
 Of the seperator fits.
```

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