random-cat-img
v1.1.7
Published
An npm module that provides random cat images. Fast and reliable.
Downloads
6,794
Maintainers
Keywords
Readme
📑 » About
This module retrieves random cat images from the api.sefinek.net API using native module like https. Each image is appropriately compressed.
😼 » Installation
npm install random-cat-img
🐈 » Usage
• Importing
const getRandomCat = require('random-cat-img');
• Async/await example
(async () => {
const data = await getRandomCat();
console.log(data.message); // https://cdn.sefinek.net/images/animals/cat/cat-1362565-min.jpg
})();
• Promise example
getRandomCat().then(data => console.log(data.message)); // https://cdn.sefinek.net/images/animals/cat/my-cat-1384175-min.jpg
• Returned object
{
"success": true,
"status": 200,
"info": { "category": "animals", "endpoint": "cat" },
"message": "https://cdn.sefinek.net/images/animals/cat/neva-masquerade-cats-1375033-min.jpg"
}
✨ » Final information
Open a new Issue if you have any questions or issues related to this module or API.
If you like this module, please star the repository.