zipDirectory method
void
zipDirectory(})
Zips a dir
to a Zip file synchronously.
filename
determines where the Zip file will be created. If filename
is not specified, the name of the directory will be used with a '.zip'
extension. If filename
is within dir
, it will throw a FormatException.
See also:
- zipDirectoryAsync for the asynchronous version of this method.
_composeZipDirectoryPath
for the logic of composing the Zip file path.
Implementation
@override
void zipDirectory(Directory dir,
{String? filename,
int? level,
bool followLinks = true,
DateTime? modified}) {
final dirPath = dir.path;
final zip_path = filename ?? '$dirPath.zip';
level ??= GZIP;
create(zip_path, level: level);
addDirectory(dir,
includeDirName: false, level: level, followLinks: followLinks);
close();
}