UNPKG

4.21 kBTypeScriptView Raw
1import { EventEmitter, Subscription } from '@unimodules/core';
2import { DownloadOptions, DownloadPauseState, DownloadProgressCallback, DownloadProgressData, DownloadResult, EncodingType, FileInfo, FileSystemAcceptedUploadHttpMethod, FileSystemDownloadResult, FileSystemRequestDirectoryPermissionsResult, FileSystemSessionType, FileSystemUploadOptions, FileSystemUploadResult, FileSystemUploadType, ProgressEvent, ReadingOptions, WritingOptions } from './FileSystem.types';
3export { DownloadOptions, DownloadPauseState, DownloadProgressCallback, DownloadProgressData, DownloadResult, EncodingType, FileInfo, FileSystemDownloadResult, FileSystemRequestDirectoryPermissionsResult, FileSystemAcceptedUploadHttpMethod, FileSystemSessionType, FileSystemUploadOptions, FileSystemUploadResult, FileSystemUploadType, ProgressEvent, ReadingOptions, WritingOptions, };
4export declare const documentDirectory: string | null;
5export declare const cacheDirectory: string | null;
6export declare const bundledAssets: string | null, bundleDirectory: string | null;
7export declare function getInfoAsync(fileUri: string, options?: {
8 md5?: boolean;
9 size?: boolean;
10}): Promise<FileInfo>;
11export declare function readAsStringAsync(fileUri: string, options?: ReadingOptions): Promise<string>;
12export declare function getContentUriAsync(fileUri: string): Promise<string>;
13export declare function writeAsStringAsync(fileUri: string, contents: string, options?: WritingOptions): Promise<void>;
14export declare function deleteAsync(fileUri: string, options?: {
15 idempotent?: boolean;
16}): Promise<void>;
17export declare function deleteLegacyDocumentDirectoryAndroid(): Promise<void>;
18export declare function moveAsync(options: {
19 from: string;
20 to: string;
21}): Promise<void>;
22export declare function copyAsync(options: {
23 from: string;
24 to: string;
25}): Promise<void>;
26export declare function makeDirectoryAsync(fileUri: string, options?: {
27 intermediates?: boolean;
28}): Promise<void>;
29export declare function readDirectoryAsync(fileUri: string): Promise<string[]>;
30export declare function getFreeDiskStorageAsync(): Promise<number>;
31export declare function getTotalDiskCapacityAsync(): Promise<number>;
32export declare function downloadAsync(uri: string, fileUri: string, options?: DownloadOptions): Promise<FileSystemDownloadResult>;
33export declare function uploadAsync(url: string, fileUri: string, options?: FileSystemUploadOptions): Promise<FileSystemUploadResult>;
34export declare function createDownloadResumable(uri: string, fileUri: string, options?: DownloadOptions, callback?: DownloadProgressCallback, resumeData?: string): DownloadResumable;
35export declare class DownloadResumable {
36 _uuid: string;
37 _url: string;
38 _fileUri: string;
39 _options: DownloadOptions;
40 _resumeData?: string;
41 _callback?: DownloadProgressCallback;
42 _subscription?: Subscription | null;
43 _emitter: EventEmitter;
44 constructor(url: string, fileUri: string, options?: DownloadOptions, callback?: DownloadProgressCallback, resumeData?: string);
45 downloadAsync(): Promise<FileSystemDownloadResult | undefined>;
46 pauseAsync(): Promise<DownloadPauseState>;
47 resumeAsync(): Promise<FileSystemDownloadResult | undefined>;
48 savable(): DownloadPauseState;
49 _addSubscription(): void;
50 _removeSubscription(): void;
51}
52/**
53 * Android only
54 */
55export declare namespace StorageAccessFramework {
56 function getUriForDirectoryInRoot(folderName: string): string;
57 function requestDirectoryPermissionsAsync(initialFileUrl?: string | null): Promise<FileSystemRequestDirectoryPermissionsResult>;
58 function readDirectoryAsync(dirUri: string): Promise<string[]>;
59 function makeDirectoryAsync(parentUri: string, dirName: string): Promise<string>;
60 function createFileAsync(parentUri: string, fileName: string, mimeType: string): Promise<string>;
61 const writeAsStringAsync: typeof import("./FileSystem").writeAsStringAsync;
62 const readAsStringAsync: typeof import("./FileSystem").readAsStringAsync;
63 const deleteAsync: typeof import("./FileSystem").deleteAsync;
64 const moveAsync: typeof import("./FileSystem").moveAsync;
65 const copyAsync: typeof import("./FileSystem").copyAsync;
66}