Skip to content

Commit

Permalink
fix(): extractMetadata throwing error #33
Browse files Browse the repository at this point in the history
  • Loading branch information
AlenVelocity committed Jan 2, 2022
1 parent 1f61a6b commit ebdded8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/extractMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@ import { IRawMetadata } from '.'
export const extractMetadata = async (image: Buffer): Promise<Partial<IRawMetadata>> => {
const img = new Image()
await img.load(image)
const exif = img.exif.toString('utf-8')
const exif = img.exif?.toString('utf-8') ?? '{}'
return JSON.parse(exif.substring(exif.indexOf('{'), exif.lastIndexOf('}') + 1) ?? '{}') as IRawMetadata
}

0 comments on commit ebdded8

Please sign in to comment.