# snoostorm-es6

> es6 fork of snoostorm

Latest version **1.0.5** (published 2019-03-14) · 0 weekly downloads

## Install

```sh
npm install snoostorm-es6
pnpm add snoostorm-es6
yarn add snoostorm-es6
bun add snoostorm-es6
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.5 |
| Published | 2019-03-14 |
| First published | 2019-02-25 |
| Weekly downloads | 0 |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | sabbatiw |
| Maintainers | sabbatiw |
| Keywords | reddit, snoostorm, snoowrap |

## Links

- npm: https://www.npmjs.com/package/snoostorm-es6
- Repository: https://github.com/sabbatiw/snoostorm-es6
- Homepage: https://github.com/sabbatiw/snoostorm-es6#readme
- Issues: https://github.com/sabbatiw/snoostorm-es6/issues
- npm.io page: https://npm.io/package/snoostorm-es6

## Dependencies (1)

- [snoowrap](https://npm.io/package/snoowrap.md) ^1.11.3

## Recent versions

- 1.0.5 (latest) — 2019-03-14
- 1.0.4 — 2019-03-01
- 1.0.3 — 2019-03-01
- 1.0.2 — 2019-02-25
- 1.0.1 — 2019-02-25
- 1.0.0 — 2019-02-25

## README

# snoostorm-es6

event-based wrapper around [`snoowrap`](https://not-an-aardvark.github.io/snoowrap)  
fork of [`SnooStorm`](https://github.com/MayorMonty/Snoostorm)

## usage

#### setup:

```javascript
'use strict';

const snoowrap = require('snoowrap');
const snoostorm = require('snoostorm-es6');

const options = {
    userAgent: "<user agent>",
    clientSecret: "<client secret>",
    clientId: "<client id>",
    username: "<username>",
    password: "<password>"
};

const r = new snoowrap(options);
const s = new snoostorm(r);
```

#### comment streaming
```javascript
const comments = s.Stream("comment", {
  subreddit: "all",
  results: 100, // defaults to 25, max is 100
  pollTime: 5000
});

comments.on("item", item => {
  console.log(item);
});
```

#### submission streaming
```javascript
const submissions = s.Stream("submission", {
  subreddit: "asoiaf",
  pollTime: 10000
});

submissions.on("item", item => {
  console.log(item.title);
});
```

#### inbox streaming
```javascript
// filter one of "inbox" (default), "unread", "messages", "comments", "selfreply", or "mentions"
const mentions = s.Stream("inbox", {
  filter: "mentions"
});

mentions.on("item", item => {
  console.log(item.author.name);
});
```

#### error handling
```javascript
comments.on("error", e => {
  console.log(e); // stop breaking the rate-limit
});
```

#### ending a stream
```javascript
comments.on("end", () => {
  console.log("your one hour comment stream has ended.");
});

setTimeout(() => {
  comments.emit("end");
}, 3600000);
```

---
_Source: https://npm.io/package/snoostorm-es6 · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
