Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

animated-gif-detector-papandreou

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animated-gif-detector-papandreou

Detect animated GIFs from JavaScript buffers.

  • 1.1.6-patch1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

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:

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:

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:

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.

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:

Keywords

FAQs

Package last updated on 23 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc