Skip to content
/ giph Public

A small node module/command line interface tool that fetches a random GIF from Giphy.

License

Notifications You must be signed in to change notification settings

kodie/giph

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

giph

npm package version Travis build status npm package downloads index.js file size code style license

A small node module/command line interface tool that fetches a random GIF from Giphy.

Installation/Usage

CLI

npm install --global giph
giph <keywords> [--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) and copy the URL to your clipboard.

Node

npm install --save giph
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 for more info.