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

mediasnap

v1.1.2

Published

Single entry-point media downloader for TikTok, Instagram, YouTube, Reddit and more. Node.js / NestJS ready.

Readme

mediasnap

mediasnap is a high-performance programmatic wrapper package for Node.js servers (e.g. NestJS, Express) around the open-source universalDownloader project. It strips away the HTTP/REST routing layer of the original project and exposes pure JavaScript functions for detecting platforms and downloading media from various platforms.

Supported Platforms

  • TikTok
  • Instagram
  • Facebook
  • Twitter (X)
  • YouTube
  • Reddit
  • Pinterest
  • Threads
  • LinkedIn
  • Snapchat
  • Soundcloud
  • Spotify
  • Tumblr
  • Douyin
  • Kuaishou
  • Dailymotion
  • Bluesky
  • CapCut
  • TeraBox

Installation

npm install mediasnap

Usage

Importing in Another Project

ES Modules (TypeScript / Modern Node.js)

import { downloadMedia, detectPlatform } from 'mediasnap';

CommonJS (Standard Node.js)

const { downloadMedia, detectPlatform } = require('mediasnap');

Platform Detection

Detect the downloader platform from a URL:

import { detectPlatform } from 'mediasnap';

const platform = detectPlatform('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
console.log(platform); // 'youtube'

Media Downloading

Download media directly using the unified downloadMedia(url) entry point:

import { downloadMedia } from 'mediasnap';

async function run() {
  const result = await downloadMedia('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
  
  if (result.success) {
    console.log('Platform:', result.platform);
    console.log('Title:', result.title);
    console.log('Media items:', result.media);
  } else {
    console.error('Error:', result.error);
  }
}

run();

Command Line Execution

You can test the package directly from your shell using Node's evaluation flag:

node -e "const { downloadMedia } = require('mediasnap'); downloadMedia('https://www.youtube.com/watch?v=dQw4w9WgXcQ').then(console.log);"

Return Structure

The downloadMedia function returns a Promise<DownloadResult> with the following shape:

interface AdaptedMediaItem {
  type: 'video' | 'audio' | 'image';
  url: string;                 // direct download URL
  quality: string | null;      // label (e.g. '1080p', '128kbps', 'original')
  format: string | null;       // normalized lowercase format (e.g. 'mp4', 'mp3', 'jpg')
  sizeMB?: number | null;      // estimated file size in MB if available
}

interface DownloadResult {
  success: boolean;            // true if the download succeeded, false otherwise
  platform: string;            // the detected platform name (e.g., 'youtube', 'tiktok', etc.) or 'unknown'
  title: string | null;        // post / media title
  description: string | null;  // post description or caption
  thumbnail: string | null;    // video thumbnail / image preview url
  duration: string | number | null; // duration if available
  media: AdaptedMediaItem[];   // list of extracted media items, sorted descending by quality
  error?: string;              // details of the error if success is false
}

NestJS Integration Example

// media.service.ts
import { Injectable } from '@nestjs/common';
import { downloadMedia, DownloadResult } from 'mediasnap';

@Injectable()
export class MediaService {
  async download(url: string): Promise<DownloadResult> {
    return downloadMedia(url);
  }
}

Upstream Sync

To sync this wrapper package with upstream changes from universalDownloader:

npm run sync-upstream

Author & Credits

  • Wrapped and package-maintained by Antigravity.
  • Original downloader core logic and services created by milancodess (Milan).

License

MIT