🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

reddit-fetch

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

reddit-fetch

A simple wrapper for fetching information from reddit posts.

1.5.1
latest
Source
npm
Version published
Weekly downloads
2
100%
Maintainers
1
Weekly downloads
 
Created
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

node-fetch

FAQs

Package last updated on 13 Oct 2020

Did you know?

Socket

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