GithubHelp home page GithubHelp logo

sebinsua / monitor-head-stream Goto Github PK

View Code? Open in Web Editor NEW
7.0 2.0 0.0 70 KB

๐Ÿ’ฆ Monitor the head of a stream.

JavaScript 100.00%
tail monitor head stream refresh continuous tailing follow

monitor-head-stream's Introduction

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

monitor-head-stream's People

Contributors

sebinsua avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

monitor-head-stream's Issues

monitorHeadStream is not a function

I'm getting this when I run the example, any idea?

onst 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
)
 monitorHeadStream(createStream, indexBy, skipWhenPinned),
  ^

TypeError: monitorHeadStream is not a function
    at Object.<anonymous> (/Users/usw/code/test/liquidation.js:43:3)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:425:7)
    at startup (bootstrap_node.js:146:9)
    at bootstrap_node.js:540:3

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.