@capgo/capacitor-file
Capacitor File Plugin Implements file system operations similar to the Cordova File plugin.
Overview
Section titled “Overview”Capacitor File Plugin Implements file system operations similar to the Cordova File plugin.
Core Capabilities
Section titled “Core Capabilities”requestFileSystem- Request a file system.resolveLocalFileSystemURL- Resolve a file URL to an entry.getFile- Get a file entry.getDirectory- Get a directory entry.
Public API
Section titled “Public API”| Method | Description |
|---|---|
requestFileSystem | Request a file system. |
resolveLocalFileSystemURL | Resolve a file URL to an entry. |
getFile | Get a file entry. |
getDirectory | Get a directory entry. |
readFile | Read a file as text or base64. |
readAsDataURL | Read a file as a data URL (base64 with MIME type prefix). |
writeFile | Write data to a file. |
appendFile | Append data to a file. |
deleteFile | Delete a file. |
mkdir | Create a directory. |
rmdir | Delete a directory. |
readdir | Read directory contents. |
stat | Get metadata about a file or directory. |
getMetadata | Get metadata about a file or directory. Alias for stat(). |
rename | Rename or move a file or directory. |
move | Move a file or directory. Alias for rename(). |
copy | Copy a file or directory. |
exists | Check if a file or directory exists. |
getUri | Get the URI for a file. |
truncate | Truncate a file to a specified size. |
getDirectories | Get all known file system directories. |
getFreeDiskSpace | Get the free disk space in bytes. |
addListener | Listen for read progress events. |
addListener | Listen for write progress events. |
removeAllListeners | Remove all event listeners. |
getPluginVersion | Get the plugin version. |
checkPermissions | Check 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. |
requestPermissions | Request 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. |
Source Of Truth
Section titled “Source Of Truth”This reference is synced from src/definitions.ts in capacitor-file.
Keep going from @capgo/capacitor-file
Section titled “Keep going from @capgo/capacitor-file”If you are using @capgo/capacitor-file to plan storage and file handling, connect it with Using @capgo/capacitor-file for the native capability in Using @capgo/capacitor-file, @capgo/capacitor-data-storage-sqlite for the implementation detail in @capgo/capacitor-data-storage-sqlite, Using @capgo/capacitor-data-storage-sqlite for the native capability in Using @capgo/capacitor-data-storage-sqlite, @capgo/capacitor-uploader for the implementation detail in @capgo/capacitor-uploader, and Using @capgo/capacitor-uploader for the native capability in Using @capgo/capacitor-uploader.