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

@inukshuk/exif

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@inukshuk/exif - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

7

index.js

@@ -38,6 +38,6 @@ 'use strict'

for (let type of ['exif', 'interoperability', 'printImageMatching'])
if (opts[type] && ifd[type])
if (opts[type] && isOffset(ifd[type]))
ifd[type] = IFD.read(buffer, ifd[type], isBigEndian, TAGS.EXIF, opts, meta)
if (opts.gpsInfo && ifd.gpsInfo)
if (opts.gpsInfo && isOffset(ifd.gpsInfo))
ifd.gpsInfo = IFD.read(buffer, ifd.gpsInfo, isBigEndian, TAGS.GPS, opts)

@@ -51,4 +51,7 @@

function isOffset(x) {
return typeof x === 'number' && Math.floor(x) === x && x > 0
}
module.exports = exif
module.exports.IFD = IFD
{
"name": "@inukshuk/exif",
"version": "2.0.0",
"version": "2.1.0",
"description": "A small EXIF image metadata reader",
"main": "index.js",
"engine": {
"node": ">=6"
"node": ">=6"
},

@@ -32,5 +32,5 @@ "scripts": {

"devDependencies": {
"eslint": "^5.14.0",
"mocha": "^5.2.0"
"eslint": "^8.44.0",
"mocha": "^10.2.0"
}
}

@@ -20,13 +20,12 @@ 'use strict'

// To prevent unexpected month change after setUTCMonth()
let date = new Date(1970, 0, 2)
let date = new Date(Date.UTC(
match[1],
match[2] - 1,
match[3],
match[4],
match[5],
match[6],
0
))
date.setUTCFullYear(match[1])
date.setUTCMonth(match[2] - 1)
date.setUTCDate(match[3])
date.setUTCHours(match[4])
date.setUTCMinutes(match[5])
date.setUTCSeconds(match[6])
date.setUTCMilliseconds(0)
if (offset != null && offset !== 0)

@@ -33,0 +32,0 @@ date.setUTCMinutes(date.getUTCMinutes() + offset)

@@ -6,3 +6,4 @@ 'use strict'

readUInt32,
readString,
readAsciiString,
readUcs2String,
readValues

@@ -19,2 +20,3 @@ } = require('./util')

const identity = (x) => x
const isUCS2 = (tag) => tag >= 0x9c9b && tag <= 0x9c9f

@@ -30,3 +32,3 @@ class IFD {

try {
var ifd = new IFD()
var ifd = new IFD({}, isBigEndian)
let count = readUInt16(buffer, offset, isBigEndian)

@@ -39,4 +41,4 @@

let tag = readUInt16(buffer, offset, isBigEndian)
let value = IFD.readTagValue(tag, buffer, offset + 2, isBigEndian)
let key = TAGS[tag] || tag
let value = IFD.readTagValue(buffer, offset + 2, isBigEndian)

@@ -47,4 +49,7 @@ ifd.tags[key] = value

error.offset = offset
if (meta.errors) meta.errors.push(error)
else throw error
if (meta.errors)
meta.errors.push(error)
else
throw error
}

@@ -59,4 +64,7 @@ }

error.offset = offset
if (meta.errors) meta.errors.push(error)
else throw error
if (meta.errors)
meta.errors.push(error)
else
throw error
}

@@ -67,3 +75,3 @@

static readTagValue(buffer, offset, isBigEndian) {
static readTagValue(tag, buffer, offset, isBigEndian) {
let type = readUInt16(buffer, offset, isBigEndian)

@@ -81,6 +89,10 @@

if (type === 2)
return readString(buffer, vOffset, count)
return readAsciiString(buffer, vOffset, count)
if (type === 7)
return buffer.slice(vOffset, vOffset + count)
if (type === 1 && isUCS2(tag))
return readUcs2String(buffer, vOffset, count)
let values = readValues(buffer, vOffset, size, count, isBigEndian, type)

@@ -93,3 +105,4 @@

constructor(tags = {}) {
constructor(tags = {}, isBigEndian = false) {
this.isBigEndian = isBigEndian
this.tags = tags

@@ -103,3 +116,3 @@ }

set exif(value) {
return this.tags.exif_IFD_Pointer = value
this.tags.exif_IFD_Pointer = value
}

@@ -112,7 +125,7 @@

set gpsInfo(value) {
return this.tags.gpsInfo_IFD_Pointer = value
this.tags.gpsInfo_IFD_Pointer = value
}
set interoperability(value) {
return this.tags.interoperability_IFD_Pointer = value
this.tags.interoperability_IFD_Pointer = value
}

@@ -125,3 +138,3 @@

set printImageMatching(value) {
return this.tags.printImageMatching_IFD_Pointer = value
this.tags.printImageMatching_IFD_Pointer = value
}

@@ -128,0 +141,0 @@

'use strict'
const util = module.exports = {
readString(buffer, offset, length) {
let string = buffer.toString('ascii', offset, offset + length)
return (string[string.length - 1] === '\0') ?
string.slice(0, -1) :
string
readAsciiString(buffer, offset, length) {
let slice = buffer.slice(offset, offset + length)
if (slice.some(x => x >> 7 > 0))
return slice
let string = slice.toString('ascii')
if (string[string.length - 1] === '\0')
return string.slice(0, -1)
else
return string
},
readUcs2String(buffer, offset, length) {
let string = buffer.toString('ucs2', offset, offset + length)
if (string[string.length - 1] === '\u0000')
return string.slice(0, -1)
else
return string
},
readValues(buffer, offset, size, count, ...args) {

@@ -12,0 +28,0 @@ let values = []

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