You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 7-8.RSVP
Socket
Socket
Sign inDemoInstall

exif

Package Overview
Dependencies
Maintainers
2
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.5.1 to 0.6.0

test/api-test.js

65

lib/exif/ExifImage.js

@@ -0,1 +1,5 @@

/*jslint node: true */
"use strict";
var assert = require('assert');
var fs = require('fs');

@@ -32,6 +36,6 @@ var util = require('util');

*
* If you unspecify the image, you might call exifImage.loadImage(image, callback) to get exif datas.
* If you don't set the image field, you might call exifImage.loadImage(image, callback) to get exif datas.
*
* @param options Configuration options as described above
* @param callback Function to call when data is extracted or an error occured
* @param callback Function to call when data is extracted or an error occurred
* @return Nothing of importance, calls the specified callback function instead

@@ -41,7 +45,38 @@ */

if (!(this instanceof ExifImage)) {
return new ExifImage(options, callback);
if (typeof(options)==="string") {
options = {
image: options
}
}
assert(typeof(options)==="object", "Invalid options object");
var exifImage = new ExifImage(options, function(error, data) {
if (error) {
return callback(error);
}
callback(null, data, options.image);
});
return exifImage;
}
options = options || {};
this.options=options;
if (typeof(options)==="string") {
options= {
image: options
}
} else if (options instanceof Buffer) {
options= {
image: options
}
}
var ops={};
if (options) {
for(var k in options) {
ops[k]=options[k];
}
}
this.options=ops;

@@ -51,4 +86,4 @@ // Default option values

"fujifilmMaxEntries", "olympusMaxEntries", "panasonicMaxEntries", "sanyoMaxEntries"].forEach(function(p) {
if (options[p]===undefined) {
options[p]=DEFAULT_MAX_ENTRIES;
if (ops[p]===undefined) {
ops[p]=DEFAULT_MAX_ENTRIES;
}

@@ -67,3 +102,3 @@ });

this.offsets={};
if (options.tiffOffsets) {
if (ops.tiffOffsets) {
exifData.offsets=offsets;

@@ -74,3 +109,3 @@ }

if (!options.image) {
if (!ops.image) {
// If options image is not specified, the developper must call loadImage() to parse the image.

@@ -87,3 +122,3 @@ // callback(new Error('You have to provide an image, it is pretty hard to extract Exif data from nothing...'));

setImmediate(function() {
self.loadImage(options.image, function (error, exifData) {
self.loadImage(ops.image, function (error, exifData) {
if (error) {

@@ -93,3 +128,3 @@ return callback(error);

callback(null, exifData);
callback(null, exifData, ops.image);
});

@@ -99,2 +134,4 @@ });

ExifImage.ExifImage=ExifImage;
module.exports = ExifImage;

@@ -110,2 +147,4 @@

ExifImage.prototype.loadImage = function (image, callback) {
assert(typeof(callback)==="function", "Callback must be a function");
var self = this;

@@ -136,3 +175,5 @@

ExifImage.prototype.processImage = function (source, data, callback) {
assert(typeof(source)==="string", "Source must be a string");
assert(typeof(callback)==="function", "Callback must be a function");
var offset = 0;

@@ -139,0 +180,0 @@

2

lib/exif/index.js

@@ -1,1 +0,1 @@

exports.ExifImage = require('./ExifImage');
module.exports = require('./ExifImage');
{
"name" : "exif",
"version" : "0.5.1",
"version" : "0.6.0",
"description" : "A node.js library to extract Exif metadata from images.",
"author" : "Daniel Leinich <leinich@gmx.net>",
"keywords" : ["exif", "image", "jpeg", "jpg", "tiff", "makernotes", "gps"],
"author" : [ "Daniel Leinich <leinich@gmx.net>", "Olivier Oeuillot <olivier.oeuillot@gmail.com>" ],
"keywords" : ["exif", "image", "jpeg", "jpg", "makernotes", "gps"],
"main" : "./lib/exif",

@@ -13,4 +13,10 @@ "repository" : {

"dependencies": {
"debug": "2.2"
"debug": "^2.2"
},
"devDependencies": {
"mocha": "^2.4"
},
"scripts": {
"test": "node_modules/.bin/mocha --reporter spec test/*-test.js"
}
}
SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc