Home

Awesome

random-puppy Build Status

Get a random puppy image url.

<img src="http://i.imgur.com/0zZ8m6B.jpg" width="300px">

Install

$ npm install --save random-puppy

Usage

const randomPuppy = require('random-puppy');

randomPuppy()
    .then(url => {
        console.log(url);
    })

//=> 'http://imgur.com/IoI8uS5.jpg'

API

randomPuppy()

Returns a promise for a random puppy image url from http://imgur.com/ from https://www.reddit.com/r/puppy

randomPuppy(subreddit)

Returns a promise for a random image url from the selected subreddit. Warning: We cannot promise it will be a image of a puppy!

randomPuppy.all(subreddit)

Returns an eventemitter for getting all random images for a subreddit.

const event = randomPuppy.all(subreddit);
event.on('data', url => console.log(url));

Or:

const event = randomPuppy.all('puppies');

Observable.fromEvent(event, 'data')
    .subscribe(data => {
      console.log(data);
    });

Notes

License

MIT © Dylan Greene