다운로드 (Download)
Download 모듈은 파일을 기기에 다운로드하고 저장하는 기능을 제공합니다.
메서드
file
주어진 URL의 파일을 다운로드합니다.
file(url: string): Promise<boolean>
fileWithOptions
상세 옵션을 지정하여 파일을 다운로드합니다.
fileWithOptions(options: DownloadOptions): Promise<boolean>
image
이미지를 다운로드하여 갤러리에 저장합니다.
image(url: string): Promise<boolean>
imageWithOptions
상세 옵션을 지정하여 이미지를 다운로드합니다.
imageWithOptions(options: DownloadOptions): Promise<boolean>
- DownloadOptions 타입:
url: 다운로드 URLfileName: 저장할 파일 이름 (선택 사항)
사용 예제
import { appify } from '@nolraunsoft/appify-sdk';
// 기본 파일 다운로드
await appify.download.file('https://example.com/document.pdf');
// 옵션을 사용한 이미지 저장
await appify.download.imageWithOptions({
url: 'https://example.com/image.jpg',
fileName: 'profile_image.jpg'
});