# animated-gif-detector

> Detect animated GIFs from JavaScript buffers.

Latest version **1.2.0** (published 2016-06-30) · ISC license · 0 weekly downloads

## Install

```sh
npm install animated-gif-detector
pnpm add animated-gif-detector
yarn add animated-gif-detector
bun add animated-gif-detector
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2016-06-30 |
| First published | 2014-07-17 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Tom Buchok |
| Maintainers | tbuchok |
| Keywords | email, marketing, mailcharts, animated, gif |

## Links

- npm: https://www.npmjs.com/package/animated-gif-detector
- Repository: https://github.com/mailcharts/animated-gif-detector
- Issues: https://github.com/mailcharts/animated-gif-detector/issues
- npm.io page: https://npm.io/package/animated-gif-detector

## Dependencies (1)

- [inherits](https://npm.io/package/inherits.md) ^2.0.1

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 1.2.0 (latest) — 2016-06-30
- 1.1.7 — 2016-03-24
- 1.1.6 — 2016-02-18
- 1.1.5 — 2016-02-18
- 1.1.4 — 2015-11-05
- 1.1.3 — 2015-11-04
- 1.1.2 — 2014-10-29
- 1.1.1 — 2014-10-08
- 1.1.0 — 2014-10-08
- 1.0.0 — 2014-09-24
- 0.3.0 — 2014-07-21
- 0.2.0 — 2014-07-17
- 0.1.1 — 2014-07-17
- 0.1.0 — 2014-07-17
- 0.0.1 — 2014-07-17

## README

animated-gif-detector
---
Detect animated GIFs from JavaScript buffers.

## Installation

`npm i animated-gif-detector`

## Motivation

Given a readable stream or a buffer directly, determine if a buffer of data is an animated GIF. This helps determine if a document contains cat pics or LOLz.

## Usage

### Streaming

This module is intended to be used as a Writable stream:

```js
var fs = require('fs')
  , animated = require('animated-gif-detector')
;
fs.createReadStream('file.gif')
  .pipe(animated())
  .on('animated', function() {
    console.log('detected animation!');
  }); 
;
```

Particularly, you may want to determine animate *as early as possible* in a given HTTP request, and abort the request as soon as you know:

```js
var http = require('http')
  , animated = require('animated-gif-detector')
;
var req = http.get('http://domain.com/file.gif')
  .pipe(animated())
  .once('animated', function() {
    req.abort();
    // do something else!
  })
;
```

### Sync

If an img is loaded as a buffer directly, a sync function is also available:

```js
var fs = require('fs')
  , animated = require('animated-gif-detector')
;

animated(fs.readFileSync('file.gif')) // => true!
```

## Browserify

This should work as a client-side package if [Browersified](http://browserify.org/).

## Tests

`npm test` runs the tests.

Please contribute weird animated GIFs to the repository to add to the test cases.

## Contributors

Thanks to hard work from the following contributors:

- Bradley Spaulding - [GitHub/bspaulding](https://github.com/bspaulding)
- Vilson Vieira - [GitHub/automata](https://github.com/automata)
- Andreas Lind - [GitHub/papandreou](https://github.com/papandreou)
- Priyank Parashar - [GitHub/paras20xx](https://github.com/paras20xx)

---
_Source: https://npm.io/package/animated-gif-detector · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
