Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

stweam

tanem68MIT1.0.15

Streams the public Twitter stream.

twitter, tweets, streams, streaming, generators, harmony

readme

stweam

build status coverage status npm version npm downloads dependency status devDependency status

Streams the public Twitter stream.

Note that the output is the "raw" Twitter stream, so you'll need to process it appropriately. Processing was deliberately left out of this module, so that you can choose your poison(s) via npm.

Requirements

  • Node.js version 0.11.x (for the harmony flag which exposes generators)
  • Keys obtained from dev.twitter.com after setting up a new app

Installation

$ npm install stweam --save

Example

// => example.js

var Stweam = require('stweam');
var stream = require('stream');
var dest = new stream.PassThrough();

var stweam = new Stweam({
  consumerKey: 'consumerKey',
  consumerSecret: 'consumerSecret',
  token: 'token',
  tokenSecret: 'tokenSecret'
});

// Optionally hook into log messages...
stweam.on('info', function(msg){
  // Do something with msg.
});

// ... or warn messages.
stweam.on('warn', function(msg){
  // Do something with msg.
});

// stweam is a Stream.
stweam.pipe(dest);

stweam
  .language('fr')
  .track('beaker')
  .follow('12345')
  .start();

To run:

$ node --harmony example.js

Also, check out chirp to see Stweam in action.

API

var stweam = new Stweam(opts)

Initialise a new Stweam with the given opts.

opts should contain:

  • consumerKey
  • consumerSecret
  • token
  • tokenSecret

stweam.track(keywords)

Set the phrases that will determine what is delivered on the stream.

See: track.

stweam.language(language)

Set the Tweet language, defaults to en.

See: language.

stweam.follow(userids)

Set the users whose Tweets will be delivered on the stream.

See: follow.

stweam.start()

Start the app.

Events

Note: I like Bunyan's opinions on log levels :)

stweam.on('info', function(msg){})

Provides detail about regular operation, rather than spamming stdout.

stweam.on('warn', function(msg){})

Might want to take a closer look at this one.

Tests

To run:

$ npm run test:spec

To generate a coverage report:

$ npm run test:cov

Credits

changelog

v1.0.15 / 2016-02-19

v1.0.14 / 2016-02-06

v1.0.13 / 2015-11-07

  • (9bb5870) Use npm run scripts instead of Make (fixes #1)

v1.0.12 / 2015-11-05

1.0.11 / 2015-10-29

v1.0.10 / 2015-10-26

  • (a626a4b) Switch from jshint to eslint (fixes #4)

v1.0.9 / 2015-10-25

v1.0.8 / 2015-08-16

v1.0.7 / 2015-03-11

v1.0.6 / 2014-12-04

v1.0.5 / 2014-11-18

v1.0.4 / 2014-11-08

v1.0.3 / 2014-10-21

v1.0.1 / 2014-09-30

  • (e4bd6f7) Generate changelog using mkclog

v1.0.0 / 2014-09-12

v0.8.6 / 2014-08-24

v0.8.5 / 2014-08-24

  • (1c6f0c2) Add follow method
  • (f2df723) Add missing changelog entry
  • (820c638) Add missing changelog entry

v0.8.4 / 2014-08-16

v0.8.3 / 2014-08-14

  • (36ef48a) Add chirp example to README

v0.8.2 / 2014-07-20

  • (06b37a1) Add http status code to log messages

v0.8.1 / 2014-07-16

v0.8.0 / 2014-07-16

  • (8273dba) Remove built in parsing

v0.7.0 / 2014-07-12

  • (d269921) Remove object mode streaming

v0.6.0 / 2014-07-06

v0.5.0 / 2014-07-06

v0.4.0 / 2014-07-06

  • (7274e28) Push the entire tweet object if the receive array is empty

v0.3.2 / 2014-07-05

v0.3.1 / 2014-07-05

v0.3.0 / 2014-07-05

  • (28dd1e7) Turn Stweam into a Transform stream

v0.2.4 / 2014-07-03

v0.2.3 / 2014-06-29

v0.2.2 / 2014-06-28

  • (86c8607) Update rate limited backoff strategy name
  • (d5645ca) Add info events
  • (cfd5b90) Stream tweet text directly to Stweam

v0.2.1 / 2014-06-28

  • (3ecec81) Stream tweet text directly to Stweam

v0.2.0 / 2014-06-28

  • (ad9143d) Let's actually emit some tweets... heh

v0.1.3 / 2014-06-28

  • (9bbfb10) Update coveralls badge link

v0.1.2 / 2014-06-28

  • (3061cff) Update version badge link

v0.1.1 / 2014-06-28

  • (5f9d4f6) Remove event emitting from Stweam class
  • (1a4d71a) Update docs

v0.1.0 / 2014-06-28