A source stream implementation for cher
Usage
const Cher = require('cher');
const tools = require('cher-tools');
const cherTwitter = require('cher-twitter');
const save = tools.pipeline.save;
const config = tools.utils.config;
const sourceStreams = [
{
name: 'twitter',
module: cherTwitter
}
];
config.fetch({
pipeline: [ save ],
sourceStreams: sourceStreams
})
.then(Cher.construct)
.spread((streams, cher) => {
const twitterSource = cher.getStream('twitter');
twitterSource
.start()
.spread((dataChannel, twitterSettings) => {
dataChannel.on('data', (data) => {
console.log(data)
});
});
});
Tests
Setup some environment variables
$ echo "twitter_CLIENT_ID=<your_client_id>" >> test/test.env
$ echo "twitter_CLIENT_SECRET=<your_client_secret>" >> test/test.env
$ echo "twitterAccessToken=<your_really_long_access_token>" >> test/test.env
$ echo "PAGES=<a_fb_page_id>" >> test/test.env
$ echo "POSTS=<a_fb_post_id_with_comments>" >> test/test.env
Run em'
$ npm test