This package has been deprecated

Author message:

This package is deprecated. Please use https://npmjs.com/package/justreddit instead.

reddit-fetch

1.5.1 • Public • Published

reddit-fetch

Downloads Minified size Version License

NPM

A simple, fast wrapper for fetching information from reddit posts.

Usage & Example

const redditFetch = require('reddit-fetch');

redditFetch({

    subreddit: 'all',
    sort: 'hot',
    allowNSFW: true,
    allowModPost: true,
    allowCrossPost: true,
    allowVideo: true

}).then(post => {
    console.table(post);
});

Options

FIELD TYPE DESCRIPTION DEFAULT
subreddit string an existing reddit community N/A
sort ?string a valid reddit sorting option 'top'
allowNSFW ?boolean whether or not the returned post can be marked as NSFW false
allowModPost ?boolean whether or not the returned post can be distinguished as a mod post false
allowCrossPost ?boolean whether or not the returned post can be a crosspost false
allowVideo ?boolean whether or not the returned post can be a video false

Function details

  • Returns a promise that resolves to a JSON object (Promise<object>).
  • By default, the Reddit JSON API should not return any removed or deleted posts.
  • Unhandled rejections can be caught and handled:
...
}).then(post => {
    // Use post data
}).catch(e => {
    console.error(`Promise rejection: ${e}`);
});

Additional Links


Made with <3 by Lily :)

Package Sidebar

Install

npm i reddit-fetch

Weekly Downloads

14

Version

1.5.1

License

MIT

Unpacked Size

9.92 kB

Total Files

6

Last publish

Collaborators

  • lilielilie