installZipToTempDir function
Installs zip bytes to temp dir and returns the full path of that directory
Implementation
String installZipToTempDir(
Uint8List bytes, {
String prefix = '',
suffix = '',
int trial = 0,
}) {
var sha = md5(bytes);
String fileName = prefix + sha + (trial == 0 ? '' : '_$trial') + suffix;
String path = path_path.join(pathOfTempDir, fileName).replaceAll(r'\', '/');
if (!directoryExists(path)) {
String uuid = uuidTimeBased();
unzipToDirectory(bytes, '$path.$uuid');
try {
pathRename('$path.$uuid', path);
} catch (_) {}
}
if (unzipCheck(bytes, path)) {
return path;
}
return installZipToTempDir(
bytes,
prefix: prefix,
suffix: suffix,
trial: trial + 1,
);
}