createTarFile function
Implementation
Future<void> createTarFile(String dirPath) async {
final dir = Directory(dirPath);
if (!dir.existsSync()) {
_fail('$dirPath does not exist');
}
// Encode a directory from disk to disk, no memory
final encoder = TarFileEncoder();
await encoder.tarDirectory(dir, compression: TarFileEncoder.gzip);
}