createArchiveZipAsync static method
Future<File>
createArchiveZipAsync({
- required Directory directory,
- required String? password,
- required File outPutFile,
- DateTime? modified,
- required ArchiveGeneralLibOptions archiveGeneralLibOptions,
Implementation
static Future<File> createArchiveZipAsync({
required Directory directory,
required String? password,
required File outPutFile,
DateTime? modified,
required ArchiveGeneralLibOptions archiveGeneralLibOptions,
}) async {
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) {
await outPutFile.parent.create(recursive: true);
}
await outPutFile.writeAsBytes(result);
}
await archiveGeneralLib.closeAsync();
return outPutFile;
}