Skip to content

Instantly share code, notes, and snippets.

@lisael
Created August 8, 2013 09:33
Show Gist options
  • Save lisael/6183186 to your computer and use it in GitHub Desktop.
Save lisael/6183186 to your computer and use it in GitHub Desktop.
"""
read lz4 compressed files and print them on stdout
shell globs allowed
"""
import sys
import glob
import argparse
import lz4
if __name__ == '__main__':
parser = argparse.ArgumentParser(
description='uncompress a lz4 file and print its content on stdout')
parser.add_argument('sources', metavar='FILE', nargs='*',
help='compressed files')
args = parser.parse_args()
files = args.sources
if not files:
files = [sys.stdin]
for name in files:
if name is sys.stdin:
print lz4.loads(glob.read())
else:
for f in glob.glob(name):
with open(f,'rb') as stream:
print lz4.loads(stream.read())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment