fromCompressedFile static method
Accepts a file of data that is zipped, x-zip-compressed, tar, or gz. Note, this function assumes that all uncompressed data is in ndjson format
Implementation
static Future<List<Resource>> fromCompressedFile(String path) async {
final Uint8List data = await File(path).readAsBytes();
if (lookupMimeType(path) == 'application/zip' ||
lookupMimeType(path) == 'application/x-zip-compressed' ||
path.split('.').last == 'zip') {
return fromCompressedData('application/zip', data);
} else if (lookupMimeType(path) == 'application/x-tar' ||
path.contains('.tar.gz')) {
return fromCompressedData('application/x-tar', data);
} else if (lookupMimeType(path) == 'application/gzip' ||
path.split('.').last == 'gz') {
return fromCompressedData('application/gzip', data);
}
return <Resource>[];
}