# icehawk

> Twitch API Helper

Latest version **1.0.9** (published 2016-04-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install icehawk
pnpm add icehawk
yarn add icehawk
bun add icehawk
```

## 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.9 |
| Published | 2016-04-24 |
| First published | 2016-04-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Robert Richey |
| Maintainers | 0x0936 |

## Links

- npm: https://www.npmjs.com/package/icehawk
- npm.io page: https://npm.io/package/icehawk

## Recent versions

- 1.0.9 (latest) — 2016-04-24
- 1.0.8 — 2016-04-24
- 1.0.7 — 2016-04-24
- 1.0.6 — 2016-04-24

## README

# Twitch API Helper

The goal of Icehawk is to simplify calls to the
[Twitch.tv API](https://github.com/justintv/Twitch-API). The public repo for
this project can be found at [GitLab](https://gitlab.com/0x0936/icehawk).

Two API calls are needed to know if a stream is online and for gathering channel
information. This module allows you to use a `.twitch()` method - passing in an
array of twitch user names - and returns all the data you would get had you made
API calls to the `streams` and `channels` endpoints.

Additionally, the returned data object contains named, streamer objects for
easy access to a streamer's data.

```js
// example
{
  monstercat: {
    channel: { ... },
    stream: { ... },
    status: 'online'
  }
}
```

## Installation

`npm install --save icehawk`

## Usage

```js
// app.js
const Icehawk = require('icehawk')

// 24/7 music streamers
const streamers = [
  'monstercat',
  'nocopyrightsounds'
]

Icehawk.twitch(streamers)
  .then(data => {
    // see how the data is structured
    console.dir(data)

    // iterate over each streamer and get their data
    streamers.forEach(streamer => {

      // data contains named objects matching streamer's name
      const { channel, stream, status } = data[streamer]
    })
  })
```

I recommend setting up [webpack](https://github.com/webpack/webpack) to create a
`bundle.js` file as the entry point into your app.

## Simple Webpack Setup

`npm install -g webpack webpack-dev-server`

In the project's root folder, create `webpack.config.js` and `index.html`

```js
// webpack.config.js
module.exports = {
  entry: './app.js',
  output: {
    path: __dirname,
    filename: 'bundle.js'
  }
}
```

```html
<!-- index.html -->
<!DOCTYPE html>
<html>
<head>
</head>
<body>
  <p>Open the developer's console and reload this page to see the output.</p>
  <script src="bundle.js"></script>
</body>
</html>
```

At the prompt in a terminal of the project's root folder, type

`$ webpack-dev-server --inline`

This will start a local web server at `http://localhost:8080` that will auto
reload the page when `app.js` is saved with changes.

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