Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sefinek/random-animals
The best npm package that retrieves images of random animals 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: 27 days ago
JSON representation
The best npm package that retrieves images of random animals 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 (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-08-12T05:52:43.000Z (5 months ago)
- Last Synced: 2024-12-06T10:54:36.195Z (28 days 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: 362 KB
- Stars: 3
- 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/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L4) | `.cat()` | Return random cats |
| [dog](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L9) | `.dog()` | Return random dogs |
| [fox](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L14) | `.fox()` | Return random foxes |
| [fish](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L19) | `.fish()` | Return random fishes |
| [alpaca](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L24) | `.alpaca()` | Return random alpacas |
| [bird](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L29) | `.bird()` | Return random bird |
| | | |
| [version](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L35) | `.version()` | Return version of this module |
| [apiVersion](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L39) | `.apiVersion()` | Return API version |
| [cdnVersion](https://github.com/sefinek24/random-animals/blob/6f0104fe82471644e89cbc52281ac73fa578a267/test/index.test.js#L44) | `.cdnVersion()` | Return [CDN](https://cdn.sefinek.net) 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/sefinek24/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/sefinek24/random-animals) page.