1// @needsAudit
2export type DocumentPickerOptions = {
3  /**
4   * The [MIME type(s)](https://en.wikipedia.org/wiki/Media_type) of the documents that are available
5   * to be picked. It also supports wildcards like `'image/*'` to choose any image. To allow any type
6   * of document you can use `'*/*'`.
7   * @default '*/*'
8   */
9  type?: string | string[];
10  /**
11   * If `true`, the picked file is copied to [`FileSystem.CacheDirectory`](./filesystem#filesystemcachedirectory),
12   * which allows other Expo APIs to read the file immediately. This may impact performance for
13   * large files, so you should consider setting this to `false` if you expect users to pick
14   * particularly large files and your app does not need immediate read access.
15   * @default true
16   */
17  copyToCacheDirectory?: boolean;
18  /**
19   * Allows multiple files to be selected from the system UI.
20   * @default false
21   *
22   */
23  multiple?: boolean;
24};
25
26export type DocumentPickerAsset = {
27  /**
28   * Document original name.
29   */
30  name: string;
31  /**
32   * Document size in bytes.
33   */
34  size?: number;
35  /**
36   * An URI to the local document file.
37   */
38  uri: string;
39  /**
40   * Document MIME type.
41   */
42  mimeType?: string;
43  /**
44   * Timestamp of last document modification.
45   */
46  lastModified?: number;
47  /**
48   * `File` object for the parity with web File API.
49   * @platform web
50   */
51  file?: File;
52};
53
54// @needsAudit @docsMissing
55export type DocumentPickerResult = {
56  /**
57   * Boolean flag which shows if request was canceled. If asset data have been returned this should
58   * always be `false`.
59   */
60  canceled: boolean;
61  /**
62   * An array of picked assets or `null` when the request was canceled.
63   */
64  assets: DocumentPickerAsset[] | null;
65  /**
66   * `FileList` object for the parity with web File API.
67   * @platform web
68   */
69  output?: FileList | null;
70} & (DocumentPickerSuccessResult | DocumentPickerCanceledResult);
71
72/**
73 * @hidden
74 */
75export type DocumentPickerSuccessResult = {
76  canceled: false;
77  assets: DocumentPickerAsset[];
78};
79
80/**
81 * @hidden
82 */
83export type DocumentPickerCanceledResult = {
84  canceled: true;
85  assets: null;
86};
87