Socket
Socket
Sign inDemoInstall

reddit-fetch

Package Overview
Dependencies
7
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    reddit-fetch

A simple wrapper for fetching information from reddit posts.


Version published
Weekly downloads
7
decreased by-77.42%
Maintainers
1
Install size
481 kB
Created
Weekly downloads
 

Readme

Source

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

FIELDTYPEDESCRIPTIONDEFAULT
subredditstringan existing reddit communityN/A
sort?stringa valid reddit sorting option'top'
allowNSFW?booleanwhether or not the returned post can be marked as NSFWfalse
allowModPost?booleanwhether or not the returned post can be distinguished as a mod postfalse
allowCrossPost?booleanwhether or not the returned post can be a crosspostfalse
allowVideo?booleanwhether or not the returned post can be a videofalse

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}`);
});

Made with <3 by Lily :)

Keywords

FAQs

Last updated on 13 Oct 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc