Coder Social home page Coder Social logo

Comments (3)

mceachen avatar mceachen commented on June 2, 2024

Thanks for bringing this issue up!

I think it would be better to rely on exit code from exiftool

For performance reasons, I run exiftool in "batch" mode, so there's no exit code to check.

The errors (like file not found) are easy to handle, as ExifTool will emit to stderr--I think it's defensible to throw an error if exiftool renders to stderr.

but if exiftool actually failed (missing binary, input file doesn't exist, etc)...I want to know and parsing error messages from your lib feels like a brittle way to do this.

Totally agreed. So--I could

  1. throw a custom error with some field you could check to see why it failed, or
  2. only throw if ExifTool emits to stderr, and update ExifTool.write to return a Promise<something> that indicates the operation was a no-op.

I think I prefer 2. It's a breaking change, but I think it's better than what I've got currently.

So: what's something look like?

  1. {state: "created" | "updated" | "unchanged"}
  2. {noop: boolean}
  3. {created?: number; updated?: number; unchanged?: number}
  4. something else (suggestions welcome)

Option 1. allows for discrimination for creates vs updates, but checking a boolean might be a bit simpler than messing with a string enum.

Option 3 requires consumers to query a bunch of fields, but supports writes to filenames with globs, like:

exiftool -Author= foo*.xmp
    1 image files updated
    6 image files unchanged

from exiftool-vendored.js.

mceachen avatar mceachen commented on June 2, 2024

OK, I'm implementing Option 3:

export interface WriteTaskResult {
  created: number
  updated: number
  unchanged: number
  warnings?: string[]
}

from exiftool-vendored.js.

mattpr avatar mattpr commented on June 2, 2024

Hey! Thanks for the fast response and turnaround on a patch. I appreciate it!

from exiftool-vendored.js.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.