mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
tests: more cloud test (#4204)
* test: add anon user test * chore: add to runner * test: fix * test: fix * test: add tests * chore: add test * chore: fix warn * chore: fix warn * fix: build * fix: test * chore: rename * chore: fix test * chore: fix test * chore: fix test * chore: disable test
This commit is contained in:
@ -1,5 +1,6 @@
|
||||
import 'dart:io';
|
||||
import 'package:path/path.dart' as p;
|
||||
import 'package:archive/archive.dart';
|
||||
|
||||
Future<void> deleteDirectoriesWithSameBaseNameAsPrefix(
|
||||
String path,
|
||||
@ -28,3 +29,25 @@ Future<void> deleteDirectoriesWithSameBaseNameAsPrefix(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> unzipFile(File zipFile, Directory targetDirectory) async {
|
||||
// Read the Zip file from disk.
|
||||
final bytes = zipFile.readAsBytesSync();
|
||||
|
||||
// Decode the Zip file
|
||||
final archive = ZipDecoder().decodeBytes(bytes);
|
||||
|
||||
// Extract the contents of the Zip archive to disk.
|
||||
for (final file in archive) {
|
||||
final filename = file.name;
|
||||
if (file.isFile) {
|
||||
final data = file.content as List<int>;
|
||||
File(p.join(targetDirectory.path, filename))
|
||||
..createSync(recursive: true)
|
||||
..writeAsBytesSync(data);
|
||||
} else {
|
||||
Directory(p.join(targetDirectory.path, filename))
|
||||
.createSync(recursive: true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user