Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected parse(data: string, err?: Error): Tags {
try {
this._raw = JSON.parse(data)[0]
} catch (jsonError) {
// TODO: should restart exiftool?
logger().warn("ExifTool.ReadTask(): Invalid JSON", {
data,
err,
jsonError
})
throw orElse(err, jsonError)
}
// ExifTool does "humorous" things to paths, like flip path separators. resolve() undoes that.
const SourceFile = _path.resolve(this._raw.SourceFile)
// Sanity check that the result is for the file we want:
if (SourceFile !== this.sourceFile) {
// Throw an error rather than add an errors string because this is *really* bad:
throw new Error(
`Internal error: unexpected SourceFile of ${this._raw.SourceFile} for file ${this.sourceFile}`
)
}
if (this.degroup) {
protected parse(data: string, err?: Error): Tags {
try {
return JSON.parse(data)[0]
} catch (jsonError) {
logger().error("ExifTool.ReadRawTask(): Invalid JSON", { data })
throw orElse(err, jsonError)
}
}
}
.map(root => {
logger().info("Scanning " + pattern + "...")
return globule
.find(pattern, { srcBase: root, nocase: true, nodir: true })
.map(ea => _path.resolve(root + "/" + ea))
})
.reduce((prev, curr) => prev.concat(curr))