createArchiveZip static method
File
createArchiveZip({
- required Directory directory,
- required String? password,
- required File outPutFile,
- DateTime? modified,
- required ArchiveGeneralLibOptions archiveGeneralLibOptions,
create archive zip
Implementation
static File createArchiveZip({
required Directory directory,
required String? password,
required File outPutFile,
DateTime? modified,
required ArchiveGeneralLibOptions archiveGeneralLibOptions,
}) {
final ArchiveGeneralLib archiveGeneralLib = ArchiveGeneralLib();
archiveGeneralLib.addFilesByDirectory(
directory: directory,
archiveGeneralLibOptions: archiveGeneralLibOptions,
directoryBase: directory,
);
final result = archiveGeneralLib.toZipBytes(
password: password,
modified: modified,
);
if (result != null) {
if (outPutFile.parent.existsSync() == false) {
outPutFile.parent.createSync(recursive: true);
}
outPutFile.writeAsBytesSync(result);
}
archiveGeneralLib.close();
return outPutFile;
}