https://github.com/sefinek/random-animals
The best npm package for fetching random animal images, such as cats, foxes, dogs, and more! ๐ป๐ฆ๐
https://github.com/sefinek/random-animals
alpacas api birds cats dogs fishes foxes image images random random-images skiffy
Last synced: about 1 month ago
JSON representation
The best npm package for fetching random animal images, such as cats, foxes, dogs, and more! ๐ป๐ฆ๐
- Host: GitHub
- URL: https://github.com/sefinek/random-animals
- Owner: sefinek
- License: mit
- Created: 2022-09-19T02:00:24.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-06T14:44:38.000Z (8 months ago)
- Last Synced: 2025-10-03T12:40:31.562Z (about 1 month ago)
- Topics: alpacas, api, birds, cats, dogs, fishes, foxes, image, images, random, random-images, skiffy
- Language: JavaScript
- Homepage: https://npmjs.com/package/@sefinek/random-animals
- Size: 198 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
ยป About this package ยซ
๐ฝ ๐ฆ
This package for npm returns random images of animals (cats, dogs, foxes etc.) from the official API.
## ๐ฅ ยป Installation
```bash
npm install @sefinek/random-animals
```
## ๐ ยป Usage
### โข Async/await example
```js
const random = require('@sefinek/random-animals');
(async () => {
const data = await random.cat();
console.log(data.message);
})();
```
### โข Promise example
```js
const random = require('@sefinek/random-animals');
random.fox().then(data => console.log(data.message));
```
## ๐ป ยป Available functions
| Name | Usage | Description |
|------------------------------------------------------------------------------------------------------------------------------|-------------------------|-----------------------------------------------|
| [cat](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L4) | `.cat()` | Return random cats |
| [dog](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L9) | `.dog()` | Return random dogs |
| [fox](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L14) | `.fox()` | Return random foxes |
| [fish](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L19) | `.fish()` | Return random fishes |
| [alpaca](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L24) | `.alpaca()` | Return random alpacas |
| [bird](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L29) | `.bird()` | Return random bird |
| | | |
| [version](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L35) | `.version()` | Return version of this module |
| [apiVersion](https://github.com/sefinek/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L39) | `.apiVersion()` | Return API version |
## ๐ ยป Returned object
```json
{
"success": true,
"status": 200,
"info": { "category": "animals", "endpoint": "cat" },
"message": "https://cdn.sefinek.net/images/animals/cat/neva-masquerade-cats-1375033-min.jpg"
}
```
## ๐ค ยป Help
If you encounter any issues or have questions, please open a new [Issue](https://github.com/sefinek/random-animals/issues/new) on GitHub.
## โญ ยป Thank you
If you find this package useful, please consider giving it a star on [GitHub](https://github.com/sefinek/random-animals) page.