reddit-api-wrapper

1.0.2 • Public • Published

npm version

downloads

NPM Package

Reddit API Wrapper

A simple, easy-to-use wrapper for the Reddit API. This Node.js package abstracts the complexities of interacting with Reddit's API, providing a straightforward interface for fetching posts from Reddit.

Installation

Install via npm:

npm install reddit-api-wrapper

Usage

Here's how you can use this package:

const reddit = require('reddit-api-wrapper');

// Fetch top posts from all of Reddit
reddit
  .getPosts('top')
  .then((posts) => console.log(posts))
  .catch((error) => console.error(error));

// Fetch top posts from a specific subreddit
reddit
  .getPostsBySubreddit('programming', 'top')
  .then((posts) => console.log(posts))
  .catch((error) => console.error(error));
s;

API

This package provides the following functions:

getPosts(filter): Fetches posts from the front page of Reddit. If a filter is provided (e.g., 'top', 'hot', 'best'), fetches posts using that filter.

getPostsBySubreddit(subreddit, filter): Fetches posts from a specific subreddit. If a filter is provided (e.g., 'top', 'hot', 'best'), fetches posts using that filter.

Readme

Keywords

none

Package Sidebar

Install

npm i reddit-api-wrapper

Weekly Downloads

2

Version

1.0.2

License

ISC

Unpacked Size

2.46 kB

Total Files

3

Last publish

Collaborators

  • gramsay7