ns_file_coordinator_util 0.9.0
ns_file_coordinator_util: ^0.9.0 copied to clipboard
Helper functions for `NSFileCoordinator` (iOS/macOS only).
Helper functions for NSFileCoordinator
(iOS/macOS only).
Usage #
NOTE: this plugin doesn't automatically call startAccessingSecurityScopedResource
. You can call it yourself with accessing_security_scoped_resource;
/// Reads an iCloud [src] file and copies it to [dest].
Future<void> readFile(String src, String dest);
/// Returns information about the given [path].
Future<NsFileCoordinatorEntity> stat(String path);
/// Gets the contents of an iCloud directory [path] and returns an array of [NsFileCoordinatorEntity].
///
/// [recursive] whether to list subdirectories recursively.
/// [filesOnly] return files only.
Future<List<NsFileCoordinatorEntity>> listContents(String path);
/// Deletes the given iCloud [path].
Future<void> delete(String path);
/// Moves [src] path to [dest].
Future<void> move(String src, String dest);
/// Copies [src] path to iCloud [dest].
Future<void> copy(String src, String dest);
/// Checks if the given iCloud [path] is a directory.
/// Returns true if the path is a directory, or false if it's a file.
/// `null` if the path doesn't exist.
Future<bool?> isDirectory(String path);
/// Creates a directory [path] like [mkdir -p].
Future<void> mkdir(String path);
/// Checks if the directory [path] is empty.
Future<void> isEmptyDirectory(String path);
Example:
final plugin = NsFileCoordinatorUtil();
await plugin.readFile(src, dest);