fromArchiveOrDirectory static method
Future<Fetcher?>
fromArchiveOrDirectory(
- String path, {
- ArchiveFactory archiveFactory = const DefaultArchiveFactory(),
Creates a Fetcher from either an archive file, or an exploded directory.
Implementation
static Future<Fetcher?> fromArchiveOrDirectory(String path,
{ArchiveFactory archiveFactory = const DefaultArchiveFactory()}) async {
File file = File(path);
bool? isDirectory = tryOrNull(() => FileSystemEntity.isDirectorySync(path));
if (isDirectory == null) {
return null;
}
if (isDirectory) {
return FileFetcher.single(href: "/", file: file);
} else {
return ArchiveFetcher.fromPath(path, archiveFactory: archiveFactory);
}
}