openFile static method

Future<RarFileImpl> openFile(
  1. File file
)

Opens and parses the RAR archive at the specified file.

Returns a RarFile containing the archive entries. Throws a RarException if parsing or opening fails.

Implementation

static Future<RarFileImpl> openFile(File file) async {
  try {
    final rarFile = RarFileImpl._(file);
    await rarFile._parse();
    return rarFile;
  } catch (e, stackTrace) {
    // Log exceptions to the console in accordance with exception guidelines
    stderr.writeln('Error opening RAR file "${file.path}": $e\n$stackTrace');
    if (e is RarException) {
      rethrow;
    }
    throw RarException('Failed to open RAR archive: ${file.path}', e);
  }
}