Last updated:
0 purchases
ns file coordinator util
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 [srcUrl] file and return a [Uint8List].
Future<Uint8List> readFile(String srcUrl);
/// Reads an iCloud [srcUrl] file and returns a stream of [Uint8List].
Future<Stream<Uint8List>> readFileStream(
String srcUrl,
{int? bufferSize, double? debugDelay});
/// Returns information about the given [url].
Future<NsFileCoordinatorEntity?> stat(String url);
/// Gets the contents of an iCloud directory [url] and returns an array of [NsFileCoordinatorEntity].
///
/// [recursive] whether to list subdirectories recursively.
/// [filesOnly] return files only.
/// [relativePathInfo] return relative path info.
Future<List<NsFileCoordinatorEntity>> listContents(String url,
{bool? recursive,
bool? filesOnly,
bool? relativePathInfo});
/// Deletes the given iCloud [url].
Future<void> delete(String url);
/// Moves [srcUrl] url to [destUrl].
Future<void> move(String srcUrl, String destUrl);
/// Copies [srcUrl] url to iCloud [destUrl].
Future<void> copy(String srcUrl, String destUrl);
/// Checks if the given iCloud [url] is a directory.
/// Returns true if the url is a directory, or false if it's a file.
/// `null` if the url doesn't exist.
Future<bool?> isDirectory(String url);
/// Creates a directory [url] like [mkdir -p].
Future<void> mkdir(String url);
/// Checks if the directory [url] is empty.
Future<bool> isEmptyDirectory(String url);
copied to clipboard
Example:
final plugin = NsFileCoordinatorUtil();
await plugin.readFile(src, dest);
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.