1.0.2 • Published 2 years ago

reddit-api-wrapper v1.0.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

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.

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago