listTarFiles function
Print the entries in the given tar file.
Implementation
void listTarFiles(String path) {
final file = File(path);
if (!file.existsSync()) {
_fail('$path does not exist');
}
final input = InputFileStream(path);
try {
final tar = _tarStream(path, input);
final tarArchive = TarDecoder();
// Tell the decoder not to store the actual file data since we don't need
// it.
tarArchive.decodeStream(tar, storeData: false);
print('${tarArchive.files.length} file(s)');
for (final f in tarArchive.files) {
print(' $f');
}
} finally {
input.closeSync();
}
}