Backups: Stream archive downloads/exports

Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Michael Pimmer authored and James Valleroy committed 2018-11-17 09:00:13 -05:00
1 parent 82a4a5fc5e
commit 1f9bb624e8
6 files changed
+81 -74

No files matched your search

+12
View File
@@ -60,6 +60,11 @@ def parse_arguments():
export_tar.add_argument('--filepath', help='Destination tarball file path',
required=True)
export_stream = subparsers.add_parser('export-stream',
help='Export archive contents as tar stream')
export_stream.add_argument('--name', help='Archive name)',
required=True)
get_exported_archive_apps = subparsers.add_parser(
'get-exported-archive-apps',
help='Get list of apps included in exported archive file')
@@ -175,6 +180,13 @@ def subcommand_export_tar(arguments):
pass
def subcommand_export_stream(arguments):
"""Export archive contents as tar stream."""
subprocess.run([
'borg', 'export-tar', REPOSITORY + '::' + arguments.name, '-'],
check=True)
def _read_archive_file(archive, filepath):
"""Read the content of a file inside an archive"""
arguments = ['borg', 'extract', archive, filepath, '--stdout']