You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I don't need this, but I think it's a reasonable request. If you want to take a crack at this, I'd be happy to review your PR!
Your API suggestion (ExifTool.toJSON(tags: Tags): string and ExifTool.fromJSON(json: string): Tags) sound good to me.
I've added .toJSON methods to the ExifDateTime, ExifDate, and ExifTime classes, which means that JSON.stringify() "just works".
To reconstitute from JSON, use the new exported parseJSON method:
import{exiftool,parseJSON}from"exiftool-vendored"consttags: Tags=awaitexiftool.readTags("/path/to/file.jpg")conststr: string=JSON.stringify(tags)// parseJSON doesn't validate the input, so we don't assert that it's a Tags// instance, but you can cast it (unsafely...)consttags2: Tags=parseJSON(str)asTags
Is your feature request related to a problem? Please describe.
I want to cache tags to disk. That is, write
exiftool.read
results to JSON file on disk.The results of
exiftool.read
involve DateTime objects though which makes deserialization difficult.Describe the solution you'd like
I'd like for be able to call
ExifTool.fromJSON(json)
, to get the original structure back. And maybe atoJSON
also.Describe alternatives you've considered
The text was updated successfully, but these errors were encountered: