exif
Advanced tools
Comparing version 0.5.1 to 0.6.0
@@ -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 @@ |
@@ -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" | ||
} | ||
} |
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
No contributors or author data
MaintenancePackage does not specify a list of contributors or an author in package.json.
Found 1 instance in 1 package
7894181
46
1716
1
3
4
+ Addeddebug@2.6.9(transitive)
+ Addedms@2.0.0(transitive)
- Removeddebug@2.2.0(transitive)
- Removedms@0.7.1(transitive)
Updateddebug@^2.2