콘텐츠로 이동

BinaryUploads — @gj-kit/expo-media

@gj-kit/expo-media/core에서 공개하는 interface입니다. package version 0.6.1의 release declaration을 그대로 표시합니다.

import { BinaryUploads } from '@gj-kit/expo-media/core';
interface BinaryUploads<TAsset, TCollectionId extends string = string> {
uploadBinary(input: {
readonly source: NamedBinarySource;
readonly collectionId?: TCollectionId | null | undefined;
/**
* JPEG APP1 파싱이 실패했을 때 **필드 단위로** 병합될 EXIF(§5.3 `mediaMetadataFromJpeg` 규칙 ②).
* 웹 피커 경로가 `asset.exif`를 여기로 넘긴다(전신 uploader.ts:709 · §5.7.4).
* 없으면 촬영 시각과 위치가 조용히 유실된다 — 이 인자가 복원된 이유다(G6).
*/
readonly fallbackExif?: Readonly<Record<string, unknown>> | undefined;
/**
* 동영상 포스터. **3상태를 보존한다**(전신 `BlobVideoUploadInput.posterBlob`, uploader.ts:566-569):
* `undefined` = 어댑터로 자동 추출 / `null` = 포스터 없음(추출 시도 금지) / 값 = 주어진 포스터.
* 이 3상태를 2상태로 접으면 "포스터를 일부러 안 만든다"를 표현할 방법이 사라진다.
*/
readonly poster?: BinarySource | null | undefined;
/**
* 동영상 재생시간(**밀리초**). 이미지에는 무시된다.
* ⚠ 초 단위를 넣지 마라 — 웹의 `HTMLVideoElement.duration`은 **초**다. 호출자가
* `normalizeDurationMs`(§7 하드닝 4)를 거쳐 넘겨야 한다. 20분 동영상이 1200ms로
* 저장되면 어떤 duration 상한도 통과한다. `createPickerFlows`의 웹 경로는 이미 거친다.
*/
readonly durationMs?: number | null | undefined;
/**
* 동영상 픽셀 치수. 이미지에는 무시된다(이미지 치수는 서버가 바이트에서 읽는다).
* ⚠ `BinarySource`만으로는 DOM 없이 복원할 수 없으므로 **호출자가 주지 않으면 영구 유실**이다 —
* 전신 `BlobVideoUploadInput.width/height`(uploader.ts:86-87)가 완료 페이로드로 가던 값이다.
*/
readonly dimensions?: {
readonly width?: number | null | undefined;
readonly height?: number | null | undefined;
} | undefined;
}): Promise<UploadResult<TAsset>>;
/**
* 웹 드롭 다건.
* ⚠ 첫 presign **이전에** 배치 전체를 검증한다 — 혼합 드롭 부분 업로드 방지(§7 하드닝 10).
* ⚠ 검증은 `maxFiles` slice **이후**에 수행한다(전신 uploader.ts:623→630 순서 보존).
* 규칙의 거처는 `webBatch.ts`다.
*/
uploadDropped(files: readonly NamedBinarySource[], options?: {
readonly collectionId?: TCollectionId | null | undefined;
readonly maxFiles?: number | undefined;
} | undefined): Promise<readonly UploadResult<TAsset>[]>;
}

이 선언은 매개변수, optionality, 제네릭, 반환값, 공개 union/type 계약의 정본입니다. 호출 전 필요한 환경·권한·오류 경계는 패키지 Golden path와 이 subpath의 import 조건을 함께 확인하세요.

  • 패키지: @gj-kit/expo-media
  • 버전: 0.6.1
  • 공개 entry: ./core
  • 소스: GitHub