npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

reddit-api-image-getter

v1.2.0

Published

CLI tool and Node.js library to fetch and download images from Reddit subreddits.

Readme

Reddit API Image Getter

CLI tool and Node.js library to fetch and download images from Reddit subreddits. Zero dependencies, uses modern Node.js built-in modules.

Install

As a CLI tool (global):

npm install -g reddit-api-image-getter

As a Node.js library:

npm install reddit-api-image-getter --save

CLI Usage

After global installation, use the reddit-images command:

# Download hot images from a subreddit
reddit-images ProgrammerHumor

# Download top images instead of hot
reddit-images typescript --top

# Specify custom output directory
reddit-images javascript --output ./my-images

# Short flags
reddit-images memes -t -o ~/Downloads/reddit-images

# Show help
reddit-images --help

# Show version
reddit-images --version

CLI Options

  • <subreddit> - The subreddit name (without r/)
  • -t, --top - Get top images instead of hot (default: hot)
  • -o, --output DIR - Output directory (default: ./images)
  • -h, --help - Show help message
  • -v, --version - Show version number

Images are automatically organized into subdirectories by subreddit name.

Library Usage (Node.js)

Use as a Node.js library in your projects:

Example

const path = require('path');
const RedditApiImageGetter = require('reddit-api-image-getter');

const getter = new RedditApiImageGetter();

// `getHotImagesOfSubReddit('subreddit')`
// returns a Promise, that, when successful returns
// an Array containing RedditImageEntry object instances.
// 
// Each RedditImageEntry object is then passed to
// `saveRedditImageEntryToDisk(imageEntry, path)`
// to be saved to disk. 
//
// See what each RedditImageEntry does in 
// lib/classes/RedditImageEntry.js and lib/classes/RedditEntry.js
//
// get the top images of a subreddit: using
// getTopImagesOfSubReddit(subreddit = 'ProgrammerHumor')
// 
getter.getHotImagesOfSubReddit('ProgrammerHumor').then(function (result) {
  for (imageEntry of result) {
    const targetDirectory = path.resolve(__dirname, 'images', 'hot');
    getter.saveRedditImageEntryToDisk(imageEntry, targetDirectory);
  }
}).catch(function (error) {
  console.log(error)
})

getter.getTopImagesOfSubReddit('ProgrammerHumor').then(function (result) {
  for (imageEntry of result) {
    // do begin with a starting '/' if you need to: 
    // https://nodejs.org/api/path.html#path_path_resolve_paths
    const targetDirectory = path.resolve(__dirname, 'images', 'top');
    getter.saveRedditImageEntryToDisk(imageEntry, targetDirectory);
  }
}).catch(function (error) {
  console.log(error);
});

Modern async/await syntax:

const RedditApiImageGetter = require('reddit-api-image-getter');
const path = require('path');

async function downloadImages() {
  const getter = new RedditApiImageGetter();

  try {
    // Get hot images
    const hotImages = await getter.getHotImagesOfSubReddit('ProgrammerHumor');
    const targetDirectory = path.resolve(__dirname, 'images', 'hot');

    for (const imageEntry of hotImages) {
      if (imageEntry.imageUrl) {
        getter.saveRedditImageEntryToDisk(imageEntry, targetDirectory);
      }
    }

    console.log(`Downloaded ${hotImages.length} images`);
  } catch (error) {
    console.error('Error:', error);
  }
}

downloadImages();

Requirements

  • Node.js >=21.0.0 (for built-in fetch support)
  • Zero dependencies!

Features

  • Zero dependencies - Uses only Node.js built-in modules
  • CLI tool - Use from command line globally
  • Node.js library - Integrate into your projects
  • TypeScript support - Full type definitions included
  • Modern async/await - Clean, modern JavaScript
  • Automatic file organization - Images sorted by subreddit
  • Duplicate prevention - Won't overwrite existing files

Example with Telegram Bot

https://www.simon-neutert.de/2020/telegraf-bot-nodejs/

Contributing

Check out the source code on GitHub and feel free to contribute!