Skip to content
Please note that GitHub no longer supports Internet Explorer.

We recommend upgrading to the latest Microsoft Edge, Google Chrome, or Firefox.

Learn more
πŸ’¦ Monitor the head of a stream.
JavaScript
Branch: master
Clone or download
Cannot retrieve the latest commit at this time.
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
example
src
test
.babelrc
.editorconfig
.gitignore
.npmignore
.travis.yml
CHANGELOG.md
README.md
package.json
yarn.lock

README.md

monitor-head-stream Build Status npm version

πŸ’¦ Monitor the head of a stream

This module polls streams of objects for their latest item(s).

It's sort of like tail -f for Streams, but acts upon the head of the stream.

It was created in order to help implement small-scale firehoses.

Other applications might include sending alerts via SMS or OSX notifications on breaking news or the mention of particular topics.

Example

import { TimelineStream } from 'scrape-twitter'
import JSONStream from 'JSONStream'
import pump from 'pump'

import monitorHeadStream from 'monitor-head-stream'

const createStream = () => new TimelineStream('POTUS')
const indexBy = obj => obj.id
const skipWhenPinned = obj => obj.isPinned === true

pump(
  monitorHeadStream(createStream, indexBy, skipWhenPinned),
  JSONStream.stringify('[\n', ',\n', '\n]\n'),
  process.stdout
)

Install

With yarn:

yarn add monitor-head-stream

With npm:

npm install --save monitor-head-stream
You can’t perform that action at this time.