Skip to content

mediaMetadataFromJpeg — @gj-kit/expo-media

A public function from @gj-kit/expo-media. The signature below is taken directly from the 0.6.1 release declaration.

import { mediaMetadataFromJpeg } from '@gj-kit/expo-media';
/**
* 전신 `extractPhotoMetadataFromBlob(blob, fallbackExif, contentType)`(photoMetadata.ts:265-290).
* 초안이 지웠던 인자 2개를 `options`로 **복원**한다(G6 · §7.1). **4규칙이 계약이다**:
* ① 비-JPEG 스킵 — `(contentType ?? source.type)`이 'jpeg'/'jpg'를 포함하지 않으면 파싱하지 않고
* fallback을 그대로 반환한다.
* ② **필드 단위 병합** — `parsed?.X ?? fallback?.X`. 객체 단위 폴백이 아니다.
* capturedAt만 파싱되고 geoPoint는 fallback에서 오는 조합이 **정상 결과**다.
* ③ 파싱 예외 시 fallback 반환 — throw 금지. 메타데이터 때문에 업로드가 죽어선 안 된다.
* ④ ①②③ 이후에도 유효값이 없으면 `undefined`(빈 객체 금지 — `mediaMetadataFromExif`와 동일).
*
* ⚠ 인자를 지우면 웹 피커 경로(`fallbackExif: asset.exif`)에서 JPEG 파싱이 실패했을 때 피커가 준
* EXIF가 통째로 버려져 촬영시각·위치가 유실된다. 그 유실은 컴파일도 테스트도 통과한다.
*/
declare function mediaMetadataFromJpeg(source: BinarySource, options?: {
readonly fallbackExif?: ReadonlyExifRecord | null | undefined;
readonly contentType?: MediaContentType | string | null | undefined;
} | undefined): Promise<MediaMetadata | undefined>;

This declaration is the source of truth for parameters, optionality, generics, return values, and public union/type contracts. Check the package golden path and this subpath’s import conditions for required environment, permission, and error boundaries before calling it.

  • Package: @gj-kit/expo-media
  • Version: 0.6.1
  • Public entry: .
  • Source: GitHub