Skip to content

@capgo/capacitor-file

Capacitor File Plugin Implements file system operations similar to the Cordova File plugin.

Capacitor File Plugin Implements file system operations similar to the Cordova File plugin.

  • requestFileSystem - Request a file system.
  • resolveLocalFileSystemURL - Resolve a file URL to an entry.
  • getFile - Get a file entry.
  • getDirectory - Get a directory entry.
MethodDescription
requestFileSystemRequest a file system.
resolveLocalFileSystemURLResolve a file URL to an entry.
getFileGet a file entry.
getDirectoryGet a directory entry.
readFileRead a file as text or base64.
readAsDataURLRead a file as a data URL (base64 with MIME type prefix).
writeFileWrite data to a file.
appendFileAppend data to a file.
deleteFileDelete a file.
mkdirCreate a directory.
rmdirDelete a directory.
readdirRead directory contents.
statGet metadata about a file or directory.
getMetadataGet metadata about a file or directory. Alias for stat().
renameRename or move a file or directory.
moveMove a file or directory. Alias for rename().
copyCopy a file or directory.
existsCheck if a file or directory exists.
getUriGet the URI for a file.
truncateTruncate a file to a specified size.
getDirectoriesGet all known file system directories.
getFreeDiskSpaceGet the free disk space in bytes.
addListenerListen for read progress events.
addListenerListen for write progress events.
removeAllListenersRemove all event listeners.
getPluginVersionGet the plugin version.
checkPermissionsCheck the current permission status for file operations. On Android, this checks for external storage permissions. On iOS and web, this always returns ‘granted’ as no special permissions are needed.
requestPermissionsRequest permissions for file operations. On Android, this requests external storage permissions needed for accessing files outside the app’s private directories. On iOS and web, this always returns ‘granted’ as no special permissions are needed.

This reference is synced from src/definitions.ts in capacitor-file.