ns_file_coordinator_util 0.22.0 copy "ns_file_coordinator_util: ^0.22.0" to clipboard
ns_file_coordinator_util: ^0.22.0 copied to clipboard

PlatformiOSmacOS

Helper functions for `NSFileCoordinator` (iOS/macOS only).

pub package

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].
///
/// [start] and [count] are optional parameters to read only a part of the file.
Future<Uint8List> readFileSync(String srcUrl, {int? start, int? count});

/// Reads an iCloud [srcUrl] file and returns a stream of [Uint8List].
Future<Stream<Uint8List>> readFileStream(
    String srcUrl,
    {int? bufferSize, double? debugDelay, int? start});

/// 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> copyPath(String srcUrl, String destUrl, {bool? overwrite});

/// 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<String> mkdirp(String url, List<String> components);

/// Checks if the directory [url] is empty.
Future<bool> isEmptyDirectory(String url);

Example:

final plugin = NsFileCoordinatorUtil();
await plugin.readFile(src, dest);
1
likes
150
points
24
downloads

Publisher

verified publisherflutter-cavalry.com

Weekly Downloads

Helper functions for `NSFileCoordinator` (iOS/macOS only).

Repository (GitHub)
View/report issues

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ns_file_coordinator_util