brendan-duncan / archive

Dart library to encode and decode various archive and compression formats, such as Zip, Tar, GZip, ZLib, and BZip2.
MIT License
415 stars 143 forks source link

Exclude items #356

Open adrianvintu opened 1 month ago

adrianvintu commented 1 month ago

Can we have a method to exclude unwanted files and folders from the archiving?

      await ZipFile.createFromDirectory(
          sourceDir: dataDir,
          zipFile: zipFile,
          onZipping: (filePath, isDirectory, progress) {
            if (filePath.startsWith("EXCLUDE_FOLDER"))
              return ZipFileOperation.skipItem;
            return ZipFileOperation.includeItem;
          });

https://github.com/kineapps/flutter_archive/blob/bb5349b2a8c35bffae43c1d9d70ec0466e602851/lib/flutter_archive.dart#L57

brendan-duncan commented 1 month ago

I added a filter argument to zipDirectory similar to that FluterArchive, https://github.com/brendan-duncan/archive/blob/main/lib/src/io/zip_file_progress.dart

adrianvintu commented 1 month ago

wow, you were so quick @brendan-duncan !

thank you very much for the update, i though it will take months!

brendan-duncan commented 1 month ago

It may still be months before I can get to releasing this 4.0 version, so don't celebrate too quickly, I'm still slow :-) I only get time once in a while to poke away at this, between work being particularly busy and family wanting me off the computer more.

adrianvintu commented 1 month ago

I know the feeling :)

Thank you for your amazing work!