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 🙏

© 2025 – Pkg Stats / Ryan Hefner

@elselab-io/node-tmdb-sdk

v1.0.6

Published

A lightweight JavaScript SDK for The Movie Database (TMDB) REST API

Readme

@elselab-io/node-tmdb-sdk

npm version License: MIT Tests

A lightweight JavaScript SDK for The Movie Database (TMDB) REST API. This SDK provides a simple and intuitive way to interact with TMDB's API endpoints.

🚀 Installation

npm install @elselab-io/node-tmdb-sdk

⚡ Quick Start

import TMDB from '@elselab-io/node-tmdb-sdk';

// Initialize the SDK with your API key
const tmdb = new TMDB('your-api-key');

// Get movie details
const movie = await tmdb.movie.getDetails('550'); // Fight Club
console.log(movie.title); // "Fight Club"

✨ Features

  • 📱 Modern JavaScript (ESM) - Built with modern ES modules
  • 🔄 Promise-based API - Clean async/await support throughout
  • 🎯 Clean and intuitive interface - Simple and easy to use
  • 🛠️ Built with Axios - Reliable HTTP communication
  • 🛡️ Comprehensive error handling - Robust error management
  • 💾 Flexible caching system - Support for file-based and Redis caching

📖 Examples

Check out the examples directory for more detailed usage examples. Here's a quick example showing how to get movie details with additional data:

const movieDetails = await tmdb.movie.getDetails('238', {
  language: 'en-US',
  append_to_response: 'videos,credits'
});

console.log({
  title: movieDetails.title,
  director: movieDetails.credits.crew.find(person => person.job === 'Director')?.name,
  cast: movieDetails.credits.cast.slice(0, 5).map(actor => actor.name)
});

💾 Caching

The SDK includes a flexible caching system to improve performance and reduce API calls. You can use either file-based caching or Redis caching.

📁 File-based Caching

import TMDB, { FileCacheAdapter } from '@elselab-io/node-tmdb-sdk';

// Create a file cache adapter
const fileCache = new FileCacheAdapter({
  directory: './tmdb-cache', // Cache directory (default: './cache')
  defaultTTL: 3600 // Cache TTL in seconds (default: 1 hour)
});

// Initialize TMDB with the file cache
const tmdb = new TMDB('your-api-key', {
  cache: fileCache,
  enableCache: true, // Enable caching (default: true)
  cacheTTL: 3600 // Default TTL in seconds (default: 1 hour)
});

// Use the SDK as usual - responses will be cached automatically
const movie = await tmdb.movie.getDetails('550');

🔴 Redis Caching

import TMDB, { RedisCacheAdapter } from '@elselab-io/node-tmdb-sdk';
import { createClient } from 'redis'; // You need to install redis package

// Create Redis client
const redisClient = createClient();
await redisClient.connect();

// Create a Redis cache adapter
const redisCache = new RedisCacheAdapter(redisClient, {
  keyPrefix: 'tmdb:', // Prefix for cache keys (default: 'tmdb:')
  defaultTTL: 3600 // Default TTL in seconds (default: 1 hour)
});

// Initialize TMDB with the Redis cache
const tmdb = new TMDB('your-api-key', {
  cache: redisCache
});

// Use the SDK as usual - responses will be cached in Redis
const movie = await tmdb.movie.getDetails('550');

🚫 Disabling Cache for Specific Requests

You can disable caching for specific requests by passing an options object as the third parameter:

// This request will bypass the cache
const freshMovie = await tmdb.movie.getDetails('550', { language: 'en-US' }, { 
  useCache: false 
});

See the examples/cache-examples.js file for more detailed examples of using the caching system.

🔑 API Key

To use this SDK, you'll need a TMDB API key. You can obtain one by:

  1. Creating an account on TMDB
  2. Going to your API settings
  3. Following the steps to generate an API key

📄 License

MIT License - see LICENSE file for details.

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.


Made with ❤️ by Else Lab

WebsiteGitHubContact