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.0.0 to 1.1.0

test/files/generic-header.gif

12

index.js

@@ -31,3 +31,5 @@ var Writable = require('stream').Writable

var isAnimated = function(buffer, pointer) {
var result = false;
var result = false
, count = 0
;
for (var i = 0; i < buffer.length; i++) {

@@ -38,8 +40,10 @@ result = pointer == BLOCK_TERMINATOR.value &&

buffer.toString('hex', i + DELAY_TIME.head, i + DELAY_TIME.tail) > DELAY_TIME.value;
pointer = buffer.toString('hex', i, i + 1);
if (result)
count += 1;
if (count > 1)
break;
pointer = buffer.toString('hex', i, i + 1);
}
return { pointer: pointer, animated: result };
return { pointer: pointer, animated: count > 1 };
}

@@ -46,0 +50,0 @@

{
"name": "animated-gif-detector",
"version": "1.0.0",
"version": "1.1.0",
"description": "Detect animated GIFs from JavaScript buffers.",

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

@@ -223,2 +223,15 @@ var path = require('path')

test('generic-header.gif', function(t) {
var file = path.join(process.cwd(), 'test', 'files', 'generic-header.gif')
, result = false
;
fs.createReadStream(file)
.pipe(animated())
.once('animated', function() { result = true; })
.on('finish', function() {
t.notOk(result, 'is NOT animated');
t.end();
});
});
test('sync => true', function(t) {

@@ -225,0 +238,0 @@ var filePath = path.join(process.cwd(), 'test', 'files', 'example.gif');

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