npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

f-giphy-pfft-js-fetch-api

v3.0.5

Published

Javascript API to fetch gifs and stickers from the GIPHY API.

Downloads

4

Readme

f-giphy-pfft-js-fetch-api

Javascript API to fetch gifs and stickers from the GIPHY API.

Get started with your own api key: https://developers.giphy.com/docs/

import { GiphyFetch } from 'f-giphy-pfft-js-fetch-api'

const gf = new GiphyFetch('your api key')

// fetch 10 gifs
const { data: gifs } = await gf.trending({ limit: 10 })

Try it out:

Edit f-giphy-pfft-js-fetch-api

Fetch GIFs, Stickers, and Animated Text

search

Search all Giphy GIFs for a word or phrase. Punctuation will be stripped and ignored.

Signature:
search(term: string, options?: SearchOptions): Promise<GifsResult>
Search Options:

| option | type | description | default | | :----- | :----- | :---------------------------------------------- | :-----: | | lang | string | See list of supported languages here. | en | | sort | number | Specifies the starting position of the results. | recent |

Other Options: Type Option, Rating Option, Pagination Options

Example:
const { data: gifs } = await gf.search('dogs', { sort: 'relevant', lang: 'es', limit: 10, type: 'stickers' })

trending

Fetch GIFs currently trending online. Hand curated by the Giphy editorial team. The data returned mirrors the GIFs showcased on the Giphy homepage.

Signature:
trending(options?: TrendingOptions): Promise<GifsResult>

Trending Options: Type Option, Rating Option, Pagination Options

Example:
const { data: gifs } = await gf.trending({ limit: 10, offset: 25, rating: 'g' })

gif by id

Fetch a gif by id

Signature:
gif(id: string): Promise<GifResult>
Example:
const { data: gif } = await gf.gif('3oEjHGr1Fhz0kyv8Ig')

gifs by ids, or category and subcategory

Signature:
// by id
gifs(ids: string[]): Promise<GifsResult>
// by category and subcatetory
gifs(category: string, subcategory: string): Promise<GifsResult>
Example:
// by id
const { data: gifs } = await gf.gifs(['3oEjHGr1Fhz0kyv8Ig'])
// by category and subcatetory
const { data: gifs } = await gf.gifs('tv', 'arrested-development')

animate

Create animated text gifs dynamicaly based on the text input. This endpoint will require you to create a new SDK key

Signature:
animate(text: string, options?: PaginationOptions): Promise<GifsResult>

Options: Pagination Options

Example:
const { data: gifs } = await gf.animate('some text to animate!', { limit: 5 })

related

Fetch related gifs based on the id of a gif

Signature:
related(id: string, options?: RelatedOptions): Promise<GifsResult>

Options: Pagination Options, Type Option

Example:
const { data: gifs } = await gf.related('3oEjHGr1Fhz0kyv8Ig', { limit: 10 })

emoji

Fetch emoji. Emoji are stickers from a currated channel. There's no search or trending emoji.

Signature:
emoji(options?: PaginationOptions): Promise<GifsResult>

Emoji Options: Pagination Options

Example:
const { data: gifs } = await gf.emoji()

random

Returns a random single GIF

Signature:
random(options?: RandomOptions): Promise<GifResult>
Random Options:

| option | type | description | default | | :----- | :----- | :---------------------------------- | :-------: | | tag | string | The GIF tag to limit randomness by. | undefined |

Options: Type Option

Example:
const { data: gif } = await gf.random({ tag: 'beer', type: 'stickers' })

Fetch Categories and Subcategories

categories

categories(options?: CategoriesOptions): Promise<CategoriesResult>
const { data: categories } = await gf.categories()
categories.forEach((category) => {
    console.log(category) // ICategory
})

Options: Pagination Options

subcategories

subcategories(category: string, options?: SubcategoriesOptions): Promise<CategoriesResult>
// Example:
const { data: categories } = await gf.subcategories('tv', { limit: 10, offset: 25, rating: 'g' })
categories.forEach((category) => {
    console.log(category) // ICategory
})

Options: Pagination Options

Shared Options

Pagination Options

| option | type | description | default | | :------- | :----- | :---------------------------------------------- | :-----: | | limit | number | Number of results to return, maximum 100 | 25 | | offset | number | Specifies the starting position of the results. | 0 |

Rating Option

| option | type | description | default | | :------- | :----- | :--------------------------------------------- | :-----: | | rating | string | limit results by rating: y, g, pg, pg-13, r. | g |

Type Option

| option | type | description | default | | :----- | :----- | :--------------------- | :-----: | | type | string | gifs / stickers / text | gifs |