Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

snoostream

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

snoostream

An event based wrapper for getting new comments and submissions from Snoowrap.

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
4
increased by300%
Maintainers
1
Weekly downloads
 
Created
Source

SnooStream

An event based wrapper for getting new comments and submissions from Snoowrap.

Features

  • Can filter new posts via regex.
  • Remove post duplicates returned from Reddit.
  • Accounts for drift between system time and Reddit server time.

Installation

npm install snoostream

Usage

How to initialize

const SnooStream = require('snoostream');

let snooStream = SnooStream({
  ... // This is all Snoowrap configuration
});

OR

const SnooStream = require('snoostream');
const Snoowrap = require('snoowrap');

let snooWrap = new Snoowrap({
  ... // This is all Snoowrap configuration
});

let snooStream = SnooStream(snooWrap);

SnooStream(options[, drift])

SnooStream(Snoowrap[, drift])

  • options Snoowrap configuration
  • Snoowrap A Snoowrap object
  • drift the number of seconds system time is ahead of Reddit server time. Usually not needed.

Create a Comment Stream

let commentStream = snooStream.commentStream('all');
// Or if you want to match with a specific regex
let commentStream = snooStream.commentStream('all', { regex: /abc/ });

commentStream.on('post', (post, match) => {
  ... // post is returned directly from Snoowrap
  ... // match contains the groups matched by regex
});

snooStream.commentStream(subreddit[, options])

  • subreddit the subreddit to poll for new comments. Default is 'all'.
  • options.regex Will only emit posts that match the provided regex
  • options.rate Rate at which to poll Reddit. Default is 1000 ms.
  • options.* Any additional options that would apply to Snoowrap.getNewComments() such as limit which limits the amount of comments fetched every call.

Create a Submission Stream

let submissionStream = snooStream.submissionStream('all');
// Or if you want to match with a specific regex
let submissionStream = snooStream.submissionStream('all', { regex: /abc/ });

submissionStream.on('post', (post, match) => {
  ... // post is returned directly from Snoowrap
  ... // match contains the groups matched by regex
});

snooStream.submissionStream(subreddit[, options])

  • subreddit the subreddit to poll for new submissions. Default is 'all'.
  • options.regex Will only emit posts that match the provided regex
  • options.rate Rate at which to poll Reddit. Default is 1000 ms.
  • options.* Any additional options that would apply to Snoowrap.getNew() such as limit which limits the amount of comments fetched every call.

Keywords

FAQs

Package last updated on 05 Mar 2017

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc