npm

Need private packages and team management tools?Check out npm Orgs. »

@jych/gif-provider

0.5.0 • Public • Published

gif-provider

pipeline status coverage report

gif-provider is a JavaScript module that allows you to querying various gif APIs. Queries can be done to a single API at a time, or to multiple, with the results aggregated.

The module currently supports fetching gifs from Giphy. Support for Tenor is in progress.

You can easily extend gif-provider to support other APIs, either by contributing on GitLab, or by implementing your own GifProvider class.

Installation

npm install --save @jych/gif-provider

Getting Started

Installing

In Node and CommonJS build systems:

const {GifProviderFactory} = require('@jych/gif-provider');

In ES6 Modules and Typescript:

import {GifProviderFactory} from 'jych/gif-provider';

Example Usage

Querying Giphy:

const {GiphyGifProvider} = require('@jych/gif-provider');
 
const gifProvider = new GiphyGifProvider();
 
gifProvider.search("rat mouse")
.then( gifs => {
    // ...
} );

Querying multiple sites:

const {CompositeGifProvider, GifProviderFactory} = require('@jych/gif-provider');
 
const gifProvider =
new CompositeGifProvider(GifProviderFactory.getProviders([ "giphy", "other", "foobar" ]));
 
gifProvider.search("rat mouse")
 .then( gifs => {
     
     // gifs is a flat array of results from each site
     
     // ...
 } );

Docs

Full docs can be generated for offline use with:

npm i @jych/gif-provider
cd node_modules/@jych/gif-provider
npm i
npm run generate-docs
cd docs
open index.html 

install

npm i @jych/gif-provider

Downloadsweekly downloads

8

version

0.5.0

license

ISC

homepage

gitlab.com

repository

Gitgitlab

last publish

collaborators

  • avatar
Report a vulnerability