zipDirectory method

Future<void> zipDirectory(
  1. Directory dir, {
  2. String? filename,
  3. int? level,
  4. bool followLinks = true,
  5. void onProgress(
    1. double
    )?,
  6. DateTime? modified,
  7. ZipFileProgress? filter,
})

Zips a dir to a Zip file asynchronously.

Implementation

Future<void> zipDirectory(Directory dir,
    {String? filename,
    int? level,
    bool followLinks = true,
    void Function(double)? onProgress,
    DateTime? modified,
    ZipFileProgress? filter}) async {
  create(
    _composeZipDirectoryPath(dir: dir, filename: filename),
    level: level ??= gzip,
    modified: modified,
  );

  await addDirectory(dir,
      includeDirName: false,
      level: level,
      followLinks: followLinks,
      onProgress: onProgress,
      filter: filter);

  await close();
}