mirror of
https://github.com/borgbackup/borg.git
synced 2024-12-28 02:38:43 +00:00
19 lines
446 B
Python
19 lines
446 B
Python
|
#!/usr/bin/env python3
|
||
|
import marshal
|
||
|
import sys
|
||
|
|
||
|
import msgpack
|
||
|
|
||
|
if len(sys.argv) not in (2, 3):
|
||
|
print('Synopsis:', sys.argv[0], '<msgpack input>', '[marshal output]', file=sys.stderr)
|
||
|
sys.exit(1)
|
||
|
|
||
|
if len(sys.argv) == 2:
|
||
|
outfile = sys.stdout
|
||
|
else:
|
||
|
outfile = open(sys.argv[2], 'wb')
|
||
|
|
||
|
with outfile:
|
||
|
with open(sys.argv[1], 'rb') as infile:
|
||
|
marshal.dump(msgpack.unpack(infile, use_list=False, encoding='utf-8'), outfile)
|