@capawesome/capacitor-file-picker
Version:
Capacitor plugin that allows the user to select a file.
849 lines • 22.1 kB
JSON
{
"api": {
"name": "FilePickerPlugin",
"slug": "filepickerplugin",
"docs": "",
"tags": [],
"methods": [
{
"name": "checkPermissions",
"signature": "() => Promise<PermissionStatus>",
"parameters": [],
"returns": "Promise<PermissionStatus>",
"tags": [
{
"name": "since",
"text": "6.1.0"
}
],
"docs": "Check permissions to access files.\n\nOnly available on Android.",
"complexTypes": [
"PermissionStatus"
],
"slug": "checkpermissions"
},
{
"name": "convertHeicToJpeg",
"signature": "(options: ConvertHeicToJpegOptions) => Promise<ConvertHeicToJpegResult>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "ConvertHeicToJpegOptions"
}
],
"returns": "Promise<ConvertHeicToJpegResult>",
"tags": [
{
"name": "since",
"text": "0.6.0"
}
],
"docs": "Convert a HEIC image to JPEG.\n\nOnly available on iOS.",
"complexTypes": [
"ConvertHeicToJpegResult",
"ConvertHeicToJpegOptions"
],
"slug": "convertheictojpeg"
},
{
"name": "copyFile",
"signature": "(options: CopyFileOptions) => Promise<void>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "CopyFileOptions"
}
],
"returns": "Promise<void>",
"tags": [
{
"name": "since",
"text": "7.1.0"
}
],
"docs": "Copy a file to a new location.",
"complexTypes": [
"CopyFileOptions"
],
"slug": "copyfile"
},
{
"name": "pickFiles",
"signature": "(options?: PickFilesOptions | undefined) => Promise<PickFilesResult>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "PickFilesOptions | undefined"
}
],
"returns": "Promise<PickFilesResult>",
"tags": [],
"docs": "Open the file picker that allows the user to select one or more files.",
"complexTypes": [
"PickFilesResult",
"PickFilesOptions"
],
"slug": "pickfiles"
},
{
"name": "pickDirectory",
"signature": "() => Promise<PickDirectoryResult>",
"parameters": [],
"returns": "Promise<PickDirectoryResult>",
"tags": [
{
"name": "since",
"text": "6.2.0"
}
],
"docs": "Open a picker dialog that allows the user to select a directory.\n\nOnly available on Android and iOS.",
"complexTypes": [
"PickDirectoryResult"
],
"slug": "pickdirectory"
},
{
"name": "pickImages",
"signature": "(options?: PickMediaOptions | undefined) => Promise<PickImagesResult>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "PickMediaOptions | undefined"
}
],
"returns": "Promise<PickFilesResult>",
"tags": [
{
"name": "since",
"text": "0.5.3"
}
],
"docs": "Pick one or more images from the gallery.\n\nOn iOS 13 and older it only allows to pick one image.\n\nOnly available on Android and iOS.",
"complexTypes": [
"PickFilesResult",
"PickImagesOptions",
"PickImagesResult"
],
"slug": "pickimages"
},
{
"name": "pickMedia",
"signature": "(options?: PickMediaOptions | undefined) => Promise<PickMediaResult>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "PickMediaOptions | undefined"
}
],
"returns": "Promise<PickFilesResult>",
"tags": [
{
"name": "since",
"text": "0.5.3"
}
],
"docs": "Pick one or more images or videos from the gallery.\n\nOn iOS 13 and older it only allows to pick one image or video.\n\nOnly available on Android and iOS.",
"complexTypes": [
"PickFilesResult",
"PickMediaOptions",
"PickMediaResult"
],
"slug": "pickmedia"
},
{
"name": "pickVideos",
"signature": "(options?: PickMediaOptions | undefined) => Promise<PickVideosResult>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "PickMediaOptions | undefined"
}
],
"returns": "Promise<PickFilesResult>",
"tags": [
{
"name": "since",
"text": "0.5.3"
}
],
"docs": "Pick one or more videos from the gallery.\n\nOn iOS 13 and older it only allows to pick one video.\n\nOnly available on Android and iOS.",
"complexTypes": [
"PickFilesResult",
"PickVideosOptions",
"PickVideosResult"
],
"slug": "pickvideos"
},
{
"name": "requestPermissions",
"signature": "(options?: RequestPermissionsOptions | undefined) => Promise<PermissionStatus>",
"parameters": [
{
"name": "options",
"docs": "",
"type": "RequestPermissionsOptions | undefined"
}
],
"returns": "Promise<PermissionStatus>",
"tags": [
{
"name": "since",
"text": "6.1.0"
}
],
"docs": "Request permissions to access files.\n\nOnly available on Android.",
"complexTypes": [
"PermissionStatus",
"RequestPermissionsOptions"
],
"slug": "requestpermissions"
},
{
"name": "addListener",
"signature": "(eventName: 'pickerDismissed', listenerFunc: () => void) => Promise<PluginListenerHandle>",
"parameters": [
{
"name": "eventName",
"docs": "",
"type": "'pickerDismissed'"
},
{
"name": "listenerFunc",
"docs": "",
"type": "() => void"
}
],
"returns": "Promise<PluginListenerHandle>",
"tags": [
{
"name": "since",
"text": "0.6.2"
}
],
"docs": "Called when the file picker is dismissed.\n\nOnly available on iOS.",
"complexTypes": [
"PluginListenerHandle"
],
"slug": "addlistenerpickerdismissed-"
},
{
"name": "removeAllListeners",
"signature": "() => Promise<void>",
"parameters": [],
"returns": "Promise<void>",
"tags": [
{
"name": "since",
"text": "0.6.2"
}
],
"docs": "Remove all listeners for this plugin.",
"complexTypes": [],
"slug": "removealllisteners"
}
],
"properties": []
},
"interfaces": [
{
"name": "PermissionStatus",
"slug": "permissionstatus",
"docs": "",
"tags": [
{
"text": "6.1.0",
"name": "since"
}
],
"methods": [],
"properties": [
{
"name": "accessMediaLocation",
"tags": [
{
"text": "6.1.0",
"name": "since"
}
],
"docs": "Permission state for accessing media location.\n\nOn Android, this requests/checks the `ACCESS_MEDIA_LOCATION` permission.",
"complexTypes": [
"PermissionState"
],
"type": "PermissionState"
},
{
"name": "readExternalStorage",
"tags": [
{
"text": "6.1.0",
"name": "since"
}
],
"docs": "Permission state for reading external storage.\n\nOn Android, this requests/checks the `READ_EXTERNAL_STORAGE` permission.",
"complexTypes": [
"PermissionState"
],
"type": "PermissionState"
}
]
},
{
"name": "ConvertHeicToJpegResult",
"slug": "convertheictojpegresult",
"docs": "",
"tags": [
{
"text": "0.6.0",
"name": "since"
}
],
"methods": [],
"properties": [
{
"name": "path",
"tags": [
{
"text": "'/path/to/image.jpeg'",
"name": "example"
},
{
"text": "0.6.0",
"name": "since"
}
],
"docs": "The path of the converted JPEG image.",
"complexTypes": [],
"type": "string"
}
]
},
{
"name": "ConvertHeicToJpegOptions",
"slug": "convertheictojpegoptions",
"docs": "",
"tags": [
{
"text": "0.6.0",
"name": "since"
}
],
"methods": [],
"properties": [
{
"name": "path",
"tags": [
{
"text": "'/path/to/image.heic'",
"name": "example"
},
{
"text": "0.6.0",
"name": "since"
}
],
"docs": "The path of the HEIC image.",
"complexTypes": [],
"type": "string"
}
]
},
{
"name": "CopyFileOptions",
"slug": "copyfileoptions",
"docs": "",
"tags": [
{
"text": "7.1.0",
"name": "since"
}
],
"methods": [],
"properties": [
{
"name": "from",
"tags": [
{
"text": "'/path/to/file.txt'",
"name": "example"
},
{
"text": "7.1.0",
"name": "since"
}
],
"docs": "The path of the file to copy.",
"complexTypes": [],
"type": "string"
},
{
"name": "overwrite",
"tags": [
{
"text": "true",
"name": "default"
},
{
"text": "false",
"name": "example"
},
{
"text": "7.2.0",
"name": "since"
}
],
"docs": "Whether to overwrite if the file at destination already exists.",
"complexTypes": [],
"type": "boolean | undefined"
},
{
"name": "to",
"tags": [
{
"text": "'/path/to/new-file.txt'",
"name": "example"
},
{
"text": "7.1.0",
"name": "since"
}
],
"docs": "The path to copy the file to.",
"complexTypes": [],
"type": "string"
}
]
},
{
"name": "PickFilesResult",
"slug": "pickfilesresult",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "files",
"tags": [],
"docs": "",
"complexTypes": [
"PickedFile"
],
"type": "PickedFile[]"
}
]
},
{
"name": "PickedFile",
"slug": "pickedfile",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "blob",
"tags": [],
"docs": "The Blob instance of the file.\n\nOnly available on Web.",
"complexTypes": [
"Blob"
],
"type": "Blob"
},
{
"name": "data",
"tags": [],
"docs": "The Base64 string representation of the data contained in the file.\n\nIs only provided if `readData` is set to `true`.",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "duration",
"tags": [
{
"text": "0.5.3",
"name": "since"
}
],
"docs": "The duration of the video in seconds.\n\nOnly available on Android and iOS.",
"complexTypes": [],
"type": "number | undefined"
},
{
"name": "height",
"tags": [
{
"text": "0.5.3",
"name": "since"
}
],
"docs": "The height of the image or video in pixels.\n\nOnly available on Android and iOS.",
"complexTypes": [],
"type": "number | undefined"
},
{
"name": "mimeType",
"tags": [],
"docs": "The mime type of the file.",
"complexTypes": [],
"type": "string"
},
{
"name": "modifiedAt",
"tags": [
{
"text": "0.5.9",
"name": "since"
}
],
"docs": "The last modified timestamp of the file in milliseconds.",
"complexTypes": [],
"type": "number | undefined"
},
{
"name": "name",
"tags": [],
"docs": "The name of the file.",
"complexTypes": [],
"type": "string"
},
{
"name": "path",
"tags": [],
"docs": "The path of the file.\n\nOnly available on Android and iOS.",
"complexTypes": [],
"type": "string | undefined"
},
{
"name": "size",
"tags": [],
"docs": "The size of the file in bytes.",
"complexTypes": [],
"type": "number"
},
{
"name": "width",
"tags": [
{
"text": "0.5.3",
"name": "since"
}
],
"docs": "The width of the image or video in pixels.\n\nOnly available on Android and iOS.",
"complexTypes": [],
"type": "number | undefined"
}
]
},
{
"name": "PickFilesOptions",
"slug": "pickfilesoptions",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "types",
"tags": [
{
"text": "['image/png', 'application/pdf']",
"name": "example"
}
],
"docs": "List of accepted file types.\nLook at [IANA Media Types](https://www.iana.org/assignments/media-types/media-types.xhtml) for a complete list of standard media types.\n\nThis option is ignored if `limit` is set.",
"complexTypes": [],
"type": "string[] | undefined"
},
{
"name": "limit",
"tags": [
{
"text": "0",
"name": "default"
},
{
"text": "1",
"name": "example"
},
{
"text": "6.0.0",
"name": "since"
}
],
"docs": "The maximum number of files that the user can select.\nSetting this to `0` sets the selection limit to unlimited.\n\nCurrently, only `0` and `1` are supported.",
"complexTypes": [],
"type": "number | undefined"
},
{
"name": "readData",
"tags": [
{
"text": "false",
"name": "default"
}
],
"docs": "Whether to read the file data.\n\n**Attention**: Reading large files can lead to app crashes.\nIt's therefore not recommended to use this option.\nInstead, use the [fetch API](https://developer.mozilla.org/en-US/docs/Web/API/Fetch_API/Using_Fetch)\nto load the file as a blob, see [this example](https://capawesome.io/blog/the-file-handling-guide-for-capacitor/#read-a-file).",
"complexTypes": [],
"type": "boolean | undefined"
}
]
},
{
"name": "PickDirectoryResult",
"slug": "pickdirectoryresult",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "path",
"tags": [
{
"text": "6.2.0",
"name": "since"
}
],
"docs": "The path to the selected directory.",
"complexTypes": [],
"type": "string"
}
]
},
{
"name": "PickMediaOptions",
"slug": "pickmediaoptions",
"docs": "",
"tags": [
{
"text": "0.5.3",
"name": "since"
}
],
"methods": [],
"properties": [
{
"name": "readData",
"tags": [
{
"text": "false",
"name": "default"
}
],
"docs": "Whether to read the file data.",
"complexTypes": [],
"type": "boolean | undefined"
},
{
"name": "skipTranscoding",
"tags": [
{
"text": "true",
"name": "default"
},
{
"text": "https ://developer.apple.com/documentation/photokit/phpickerconfiguration/assetrepresentationmode/current",
"name": "see"
}
],
"docs": "Whether to avoid transcoding, if possible.\n\nOn iOS, for example, HEIC images are automatically transcoded to JPEG.\n\nOnly available on iOS.",
"complexTypes": [],
"type": "boolean | undefined"
},
{
"name": "limit",
"tags": [
{
"text": "0",
"name": "default"
},
{
"text": "1",
"name": "example"
},
{
"text": "5.2.0",
"name": "since"
}
],
"docs": "The maximum number of files that the user can select.\nSetting this to `0` sets the selection limit to unlimited.\n\nOn Android and Web, only `0` and `1` are supported.",
"complexTypes": [],
"type": "number | undefined"
},
{
"name": "ordered",
"tags": [
{
"text": "false",
"name": "default"
},
{
"text": "5.3.0",
"name": "since"
}
],
"docs": "Whether an ordered number is displayed instead of a check mark in the selection badge.\n\nOnly available on iOS (15+).",
"complexTypes": [],
"type": "boolean | undefined"
}
]
},
{
"name": "RequestPermissionsOptions",
"slug": "requestpermissionsoptions",
"docs": "",
"tags": [
{
"text": "6.1.0",
"name": "since"
}
],
"methods": [],
"properties": [
{
"name": "permissions",
"tags": [
{
"text": "6.1.0",
"name": "since"
},
{
"text": "[\"accessMediaLocation\", \"readExternalStorage\"]",
"name": "default"
}
],
"docs": "The permissions to request.",
"complexTypes": [
"PermissionType"
],
"type": "PermissionType[] | undefined"
}
]
},
{
"name": "PluginListenerHandle",
"slug": "pluginlistenerhandle",
"docs": "",
"tags": [],
"methods": [],
"properties": [
{
"name": "remove",
"tags": [],
"docs": "",
"complexTypes": [],
"type": "() => Promise<void>"
}
]
}
],
"enums": [],
"typeAliases": [
{
"name": "PermissionState",
"slug": "permissionstate",
"docs": "",
"types": [
{
"text": "'prompt'",
"complexTypes": []
},
{
"text": "'prompt-with-rationale'",
"complexTypes": []
},
{
"text": "'granted'",
"complexTypes": []
},
{
"text": "'denied'",
"complexTypes": []
}
]
},
{
"name": "PickImagesOptions",
"slug": "pickimagesoptions",
"docs": "",
"types": [
{
"text": "PickMediaOptions",
"complexTypes": [
"PickMediaOptions"
]
}
]
},
{
"name": "PickImagesResult",
"slug": "pickimagesresult",
"docs": "",
"types": [
{
"text": "PickMediaResult",
"complexTypes": [
"PickMediaResult"
]
}
]
},
{
"name": "PickMediaResult",
"slug": "pickmediaresult",
"docs": "",
"types": [
{
"text": "PickFilesResult",
"complexTypes": [
"PickFilesResult"
]
}
]
},
{
"name": "PickVideosOptions",
"slug": "pickvideosoptions",
"docs": "",
"types": [
{
"text": "PickMediaOptions",
"complexTypes": [
"PickMediaOptions"
]
}
]
},
{
"name": "PickVideosResult",
"slug": "pickvideosresult",
"docs": "",
"types": [
{
"text": "PickMediaResult",
"complexTypes": [
"PickMediaResult"
]
}
]
},
{
"name": "PermissionType",
"slug": "permissiontype",
"docs": "",
"types": [
{
"text": "'accessMediaLocation'",
"complexTypes": []
},
{
"text": "'readExternalStorage'",
"complexTypes": []
}
]
}
],
"pluginConfigs": []
}