Skip to content

Instantly share code, notes, and snippets.

@aperezdc
Created August 17, 2013 11:34
Show Gist options
  • Save aperezdc/6256491 to your computer and use it in GitHub Desktop.
Save aperezdc/6256491 to your computer and use it in GitHub Desktop.
Simple flate decoder, can be used e.g. for compression object streams in PDF files
#! /usr/bin/env python3
# -*- coding: utf-8 -*-
# vim:fenc=utf-8
#
# Copyright © 2013 Adrian Perez <aperez@igalia.com>
# Distributed under terms of the MIT license.
import zlib
import sys
if len(sys.argv) != 3:
raise SystemExit("Usage: " + sys.argv[0] + " input output")
with open(sys.argv[1], "rb") as ifd:
with open(sys.argv[2], "wb") as ofd:
ofd.write(zlib.decompress(ifd.read()))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment