no-noobs-apis
v1.0.2
Published
A lightweight npm package for downloading media from a given URL.
Readme
Media Downloader
A lightweight npm package for downloading media from a given URL. This package provides an easy-to-use downloadMedia function that retrieves media from various sources.
Features
- Simple and efficient media download
- Asynchronous function with error handling
- Usage tracking with request count and user count
- API-backed download from a specified endpoint
Installation
Install the package via npm:
npm install no-noobs-apisUsage
const downloadMedia = require('no-noobs-apis');(async () => {
const url = 'https://example.com/media.mp4';
try {
const mediaData = await downloadMedia(url);
console.log("Media downloaded successfully:", mediaData);
} catch (error) {
console.error(error.message);
}
})();Parameters
url(string): The URL of the media you want to download.
Response
- Returns the downloaded media data if the download is successful.
- Throws an error if the URL is invalid or the download fails.
Counters
- User Count: Tracks the number of unique users of the package.
- Install Count: Counts the total installations of the package.
- Request Count: Monitors the number of requests made to the API for media downloads.
Error Handling
Errors such as missing URL or failed downloads are handled gracefully and logged for easier debugging.
Example
const downloadMedia = require('no-noobs-apis');
downloadMedia("https://example.com/sample.mp4")
.then(mediaData => console.log("Download successful:", mediaData))
.catch(error => console.error("Download failed:", error.message));License
MIT License
Contributing
Feel free to contribute by opening issues or pull requests.
