Photo: one async method per EXIF field (closes #148)
check / check (push) Successful in 1m37s
check / check (push) Successful in 1m37s
`Photo` gains thirteen async methods, one per `PhotoExif` field and named after it: `make()`, `model()`, `lensModel()`, `dateTimeOriginal()`, `offsetTimeOriginal()`, `exposureTime()`, `fNumber()`, `iso()`, `focalLength()`, `orientation()`, `gpsLatitude()`, `gpsLongitude()` and `gpsAltitude()`. Each calls `exif()` and returns its one field, or `undefined` when the file lacks it. `exif()` is unchanged. `Photo` implements a type built from `PhotoExif`'s keys, so the type check fails when a field has no method. Each call reads the original again; a caller that wants several fields calls `exif()` once. Model: opus-5-5
This commit was merged in pull request #149.
This commit is contained in:
@@ -726,7 +726,7 @@ synchronous getters look at the disk and never touch the network:
|
||||
- `photo.isLocal` → `boolean` — whether the whole original is at `savePath`. A
|
||||
copy only in the cache does not count.
|
||||
|
||||
Five async methods may download:
|
||||
These async methods may download:
|
||||
|
||||
- `await photo.original(opts?)` → `{ path, bytes, videoPath? }` — the
|
||||
full-resolution file. For a live photo, `path` and `bytes` are its image's and
|
||||
@@ -748,6 +748,12 @@ Five async methods may download:
|
||||
UTC. EXIF is read from any image format exifreader reads (such as JPEG,
|
||||
HEIC/HEIF, AVIF, PNG, WebP and TIFF), a live photo's image included. Any other
|
||||
original gives `{}`, and a video gives `{}` without being downloaded.
|
||||
- `await photo.make(opts?)`, and likewise `model()`, `lensModel()`,
|
||||
`dateTimeOriginal()`, `offsetTimeOriginal()`, `exposureTime()`, `fNumber()`,
|
||||
`iso()`, `focalLength()`, `orientation()`, `gpsLatitude()`, `gpsLongitude()`
|
||||
and `gpsAltitude()` → one field of `exif()` each, typed as in `PhotoExif`, or
|
||||
`undefined` when the file lacks it. Each calls `exif()` with its `opts`, so
|
||||
each call reads the original again.
|
||||
|
||||
They serve from the on-disk content cache when the bytes are present and
|
||||
otherwise fetch through the pools; `original()`, `content()` and `exif()` also
|
||||
|
||||
Reference in New Issue
Block a user