{"_id":"@elselab-io/node-tmdb-sdk","name":"@elselab-io/node-tmdb-sdk","dist-tags":{"latest":"1.0.6"},"versions":{"1.0.6":{"name":"@elselab-io/node-tmdb-sdk","version":"1.0.6","description":"A lightweight JavaScript SDK for The Movie Database (TMDB) REST API","type":"module","main":"src/index.js","types":"types/elselab-node-tmdb-sdk.d.ts","scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":["tmdb","sdk","movies","api","themoviedb","movie-database","tv-shows","entertainment"],"author":{"name":"elselab"},"license":"MIT","dependencies":{"axios":"^1.6.7"},"repository":{"type":"git","url":"git+https://github.com/elselab-io/node-tmdb-sdk.git"},"bugs":{"url":"https://github.com/elselab-io/node-tmdb-sdk/issues"},"homepage":"https://github.com/elselab-io/node-tmdb-sdk#readme","engines":{"node":">=14.0.0"},"publishConfig":{"access":"public"},"_id":"@elselab-io/node-tmdb-sdk@1.0.6","gitHead":"c87f99a5532fb0855f09fe207371c5ea3be4b21c","_nodeVersion":"23.11.0","_npmVersion":"10.9.2","dist":{"integrity":"sha512-g5hhbwxMVS0FS4+ZRRRxRjywTOequIKX9kETs1wFTENaxoyc0lRtcFWlDNVGX0kjzzCcUYoejNaVKUOXzXUQjw==","shasum":"8a585cf7242c620d0299e514bd515086e52ef820","tarball":"https://registry.npmjs.org/@elselab-io/node-tmdb-sdk/-/node-tmdb-sdk-1.0.6.tgz","fileCount":19,"unpackedSize":57898,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIHkRSNQIcg0pQH77MGvFil+0wTCAESdFu+O2YrZoHPX/AiBD1m3M5T6W5j53AKegxWGMI8m1A89ZZk6vI1+0JCOQoQ=="}]},"_npmUser":{"name":"elselab","email":"support@elselab.io"},"directories":{},"maintainers":[{"name":"elselab","email":"support@elselab.io"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/node-tmdb-sdk_1.0.6_1748877037005_0.5915384905380587"},"_hasShrinkwrap":false}},"time":{"created":"2025-06-02T15:10:36.889Z","1.0.6":"2025-06-02T15:10:37.180Z","modified":"2025-06-02T15:10:37.502Z"},"maintainers":[{"name":"elselab","email":"support@elselab.io"}],"description":"A lightweight JavaScript SDK for The Movie Database (TMDB) REST API","homepage":"https://github.com/elselab-io/node-tmdb-sdk#readme","keywords":["tmdb","sdk","movies","api","themoviedb","movie-database","tv-shows","entertainment"],"repository":{"type":"git","url":"git+https://github.com/elselab-io/node-tmdb-sdk.git"},"author":{"name":"elselab"},"bugs":{"url":"https://github.com/elselab-io/node-tmdb-sdk/issues"},"license":"MIT","readme":"# @elselab-io/node-tmdb-sdk\n\n[![npm version](https://badge.fury.io/js/@elselab-io/node-tmdb-sdk.svg)](https://badge.fury.io/js/@elselab-io/node-tmdb-sdk)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Tests](https://img.shields.io/badge/tests-passing-brightgreen.svg)](./test/)\n\nA 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.\n\n## 🚀 Installation\n\n```bash\nnpm install @elselab-io/node-tmdb-sdk\n```\n\n## ⚡ Quick Start\n\n```javascript\nimport TMDB from '@elselab-io/node-tmdb-sdk';\n\n// Initialize the SDK with your API key\nconst tmdb = new TMDB('your-api-key');\n\n// Get movie details\nconst movie = await tmdb.movie.getDetails('550'); // Fight Club\nconsole.log(movie.title); // \"Fight Club\"\n```\n\n## ✨ Features\n\n- **📱 Modern JavaScript (ESM)** - Built with modern ES modules\n- **🔄 Promise-based API** - Clean async/await support throughout\n- **🎯 Clean and intuitive interface** - Simple and easy to use\n- **🛠️ Built with Axios** - Reliable HTTP communication\n- **🛡️ Comprehensive error handling** - Robust error management\n- **💾 Flexible caching system** - Support for file-based and Redis caching\n\n## 📖 Examples\n\nCheck out the `examples` directory for more detailed usage examples. Here's a quick example showing how to get movie details with additional data:\n\n```javascript\nconst movieDetails = await tmdb.movie.getDetails('238', {\n  language: 'en-US',\n  append_to_response: 'videos,credits'\n});\n\nconsole.log({\n  title: movieDetails.title,\n  director: movieDetails.credits.crew.find(person => person.job === 'Director')?.name,\n  cast: movieDetails.credits.cast.slice(0, 5).map(actor => actor.name)\n});\n```\n\n## 💾 Caching\n\nThe SDK includes a flexible caching system to improve performance and reduce API calls. You can use either file-based caching or Redis caching.\n\n### 📁 File-based Caching\n\n```javascript\nimport TMDB, { FileCacheAdapter } from '@elselab-io/node-tmdb-sdk';\n\n// Create a file cache adapter\nconst fileCache = new FileCacheAdapter({\n  directory: './tmdb-cache', // Cache directory (default: './cache')\n  defaultTTL: 3600 // Cache TTL in seconds (default: 1 hour)\n});\n\n// Initialize TMDB with the file cache\nconst tmdb = new TMDB('your-api-key', {\n  cache: fileCache,\n  enableCache: true, // Enable caching (default: true)\n  cacheTTL: 3600 // Default TTL in seconds (default: 1 hour)\n});\n\n// Use the SDK as usual - responses will be cached automatically\nconst movie = await tmdb.movie.getDetails('550');\n```\n\n### 🔴 Redis Caching\n\n```javascript\nimport TMDB, { RedisCacheAdapter } from '@elselab-io/node-tmdb-sdk';\nimport { createClient } from 'redis'; // You need to install redis package\n\n// Create Redis client\nconst redisClient = createClient();\nawait redisClient.connect();\n\n// Create a Redis cache adapter\nconst redisCache = new RedisCacheAdapter(redisClient, {\n  keyPrefix: 'tmdb:', // Prefix for cache keys (default: 'tmdb:')\n  defaultTTL: 3600 // Default TTL in seconds (default: 1 hour)\n});\n\n// Initialize TMDB with the Redis cache\nconst tmdb = new TMDB('your-api-key', {\n  cache: redisCache\n});\n\n// Use the SDK as usual - responses will be cached in Redis\nconst movie = await tmdb.movie.getDetails('550');\n```\n\n### 🚫 Disabling Cache for Specific Requests\n\nYou can disable caching for specific requests by passing an options object as the third parameter:\n\n```javascript\n// This request will bypass the cache\nconst freshMovie = await tmdb.movie.getDetails('550', { language: 'en-US' }, { \n  useCache: false \n});\n```\n\nSee the `examples/cache-examples.js` file for more detailed examples of using the caching system.\n\n## 🔑 API Key\n\nTo use this SDK, you'll need a TMDB API key. You can obtain one by:\n\n1. Creating an account on [TMDB](https://www.themoviedb.org/)\n2. Going to your [API settings](https://www.themoviedb.org/settings/api)\n3. Following the steps to generate an API key\n\n## 📄 License\n\nMIT License - see [LICENSE](LICENSE) file for details.\n\n## 🤝 Contributing\n\nContributions are welcome! Please feel free to submit a Pull Request.\n\n---\n\n<div align=\"center\">\n  <a href=\"https://elselab.io\">\n    <img src=\"https://elselab.io/wp-content/uploads/2024/04/Elselab-Logo.png\" alt=\"Else Lab\" width=\"200\">\n  </a>\n  \n  **Made with ❤️ by [Else Lab](https://github.com/elselab-io)**\n  \n  [Website](https://elselab.io) • [GitHub](https://github.com/elselab-io) • [Contact](mailto:contact@elselab.io)\n</div>\n","readmeFilename":"README.md","_rev":"1-5e1465670dc07f3cdc51301c43dab8bf"}