Skip to content

mediaDownloadFileName — @gj-kit/expo-media

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

import { mediaDownloadFileName } from '@gj-kit/expo-media/core';
/**
* 저장 파일명 = `` `${prefix}-${id || index + 1}.${ext}` `` (전신 saveImages.ts:71).
*
* 확장자 우선순위 — **저장된 fileName → contentType → URL 경로 → `'jpg'`**.
* 전신 주석(saveImages.ts:56-58) 그대로의 근거: "저장된 원본 이름을 우선한다 — 다운로드 URL은
* 흔히 경로에 확장자가 없는 토큰화된 프록시라, URL을 스니핑하면 모든 PNG/HEIC/동영상
* 다운로드가 `<prefix>-<id>.jpg`가 되어버린다."
*
* ⚠ `index`는 **0-base 필수 인자**다(G8). `id`가 없거나 빈 문자열일 때 `index + 1`이
* 유일한 구분자이며, 이것이 없으면 여러 장을 저장할 때 파일명이 전부 같아진다 —
* 브라우저는 `(1)` 접미사로 얼버무리고, MediaLibrary 경로는 캐시 파일을 덮어쓴다.
*/
declare function mediaDownloadFileName(input: {
readonly url: string;
readonly index: number;
readonly id?: string | undefined;
readonly fileName?: string | undefined;
readonly contentType?: MediaContentType | undefined;
readonly prefix?: string | undefined;
}): string;

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: ./core
  • Source: GitHub