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

animated-gif-detector

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

animated-gif-detector - npm Package Compare versions

Comparing version 1.1.4 to 1.1.5

10

index.js

@@ -22,3 +22,2 @@ var Writable = require('stream').Writable

this.buffer = new Buffer(0);
this.isGIF = false;
}

@@ -50,10 +49,13 @@

if (this.buffer.length > 4)
if (this.buffer.length > 4 && this.isGIF == undefined)
this.isGIF = this.buffer.slice(0, 3).toString() === 'GIF';
// If it's the first chunk of stream we analyze and is not GIF, stop
if (this.isGIF === false)
return next();
return this.emit('finish');
if (animated)
if (animated) {
this.emit('animated');
return this.emit('finish');
}

@@ -60,0 +62,0 @@ next();

2

package.json
{
"name": "animated-gif-detector",
"version": "1.1.4",
"version": "1.1.5",
"description": "Detect animated GIFs from JavaScript buffers.",

@@ -5,0 +5,0 @@ "main": "index.js",

var path = require('path')
, fs = require('fs')
, stream = require('stream')
, test = require('tap').test

@@ -278,2 +279,20 @@ , animated = require(path.join(process.cwd(), 'index'))

test('streaming => infinite buffer', function(t) {
var readable = new stream.Readable;
var timeout = setTimeout(function() {
throw new Error('it did not exit the infinite buffer');
}, 200);
readable._read = function() {
this.push(new Buffer('infinite')); // this readable never ends
};
readable
.pipe(animated())
.on('finish', function() {
clearTimeout(timeout);
t.ok(true, 'it ended despite infinite buffer');
t.end();
})
;
});
test('sync => false (non-image)', function(t) {

@@ -280,0 +299,0 @@ var filePath = path.join(process.cwd(), 'test', 'files', 'file.txt');

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