Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kodie/giph
A small node module/command line interface tool that fetches a random GIF from Giphy.
https://github.com/kodie/giph
cli cmd gif giphy image javascript nodejs npm picture random rnd terminal
Last synced: about 2 months ago
JSON representation
A small node module/command line interface tool that fetches a random GIF from Giphy.
- Host: GitHub
- URL: https://github.com/kodie/giph
- Owner: kodie
- License: mit
- Created: 2017-09-13T16:48:45.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-06T19:54:54.000Z (about 2 years ago)
- Last Synced: 2024-04-25T18:00:30.965Z (9 months ago)
- Topics: cli, cmd, gif, giphy, image, javascript, nodejs, npm, picture, random, rnd, terminal
- Language: JavaScript
- Homepage:
- Size: 1.6 MB
- Stars: 6
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# giph
[![npm package version](https://img.shields.io/npm/v/giph.svg?style=flat-square)](https://www.npmjs.com/package/giph) [![Travis build status](https://img.shields.io/travis/kodie/giph.svg?style=flat-square)](https://travis-ci.org/kodie/giph) [![npm package downloads](https://img.shields.io/npm/dt/giph.svg?style=flat-square)](https://www.npmjs.com/package/giph) [![index.js file size](https://img.shields.io/github/size/kodie/giph/index.js.svg?style=flat-square)](index.js) [![code style](https://img.shields.io/badge/code_style-standard-yellow.svg?style=flat-square)](https://github.com/standard/standard) [![license](https://img.shields.io/github/license/kodie/giph.svg?style=flat-square)](LICENSE.md)![](/media/preview.gif?raw=true)
A small node module/command line interface tool that fetches a random GIF from [Giphy](https://giphy.com).
## Installation/Usage
### CLI
```shell
npm install --global giph
``````shell
giph [--rating=r --file=~/Desktop/giph.gif --key=API_KEY --details --nodisplay --nocopy]
```The CLI tool will attempt to display the GIF in the terminal (currently only supported by [iTerm2 v3.0 or higher](https://iterm2.com)) and copy the URL to your clipboard.
### Node
```shell
npm install --save giph
``````javascript
const giph = require('giph')// Promises
giph(keywords, options)
.then(img => {
console.log(img)
})
.catch(err => {
console.error(err)
})// Callback
giph(keywords, options, (err, img) => {
if (err) {
console.error(err)
} else {
console.log(img)
}
})
```## Options
* **buffer** - Set to true to also return the image as a buffer. (Defaults to false)
* **file** - File path to save the gif to. (Defaults to blank)
* **key** - Giphy API key. (Just in case you would like to use your own) (Defaults to blank)
* **rating** - Rating to limit the gif to (y, g, pg, pg-13, or r). (Defaults to blank)### CLI Only
* **--details** - Display the details returned from the API in the terminal.
* **--nocopy** - Don't copy the gif URL to the clipboard.
* **--nodisplay** - Don't display the gif in the terminal.## License
MIT. See the [License file](LICENSE.md) for more info.