예제 #1
0
파일: unpack.py 프로젝트: yarang/pyhwp
def main(args):
    from hwp5 import storage
    from hwp5.proc import open_hwpfile
    import os.path

    filename = args['<hwp5file>']
    hwp5file = open_hwpfile(args)

    outdir = args['<out-directory>']
    if outdir is None:
        outdir, ext = os.path.splitext(os.path.basename(filename))
    if not os.path.exists(outdir):
        os.mkdir(outdir)
    storage.unpack(hwp5file, outdir)
예제 #2
0
def main(args):
    from hwp5.proc import open_hwpfile
    from hwp5.storage import open_storage_item
    import sys
    hwp5file = open_hwpfile(args)
    stream = open_storage_item(hwp5file, args['<stream>'])
    f = stream.open()
    try:
        while True:
            data = f.read(4096)
            if data:
                sys.stdout.write(data)
            else:
                return
    finally:
        if hasattr(f, 'close'):
            f.close()
예제 #3
0
def main(args):
    from hwp5.proc import open_hwpfile
    from hwp5.storage import open_storage_item
    import sys
    hwp5file = open_hwpfile(args)
    stream = open_storage_item(hwp5file, args['<stream>'])
    f = stream.open()
    try:
        while True:
            data = f.read(4096)
            if data:
                sys.stdout.write(data)
            else:
                return
    finally:
        if hasattr(f, 'close'):
            f.close()
        # Without this, last part of the output
        # can be truncated in Jython 2.5.3
        # See #141
        sys.stdout.close()
예제 #4
0
파일: ls.py 프로젝트: sececter/pyhwp
def main(args):
    from hwp5.storage import printstorage
    from hwp5.proc import open_hwpfile
    hwpfile = open_hwpfile(args)
    printstorage(hwpfile)
예제 #5
0
def main(args):
    from hwp5.storage import printstorage
    from hwp5.proc import open_hwpfile
    hwpfile = open_hwpfile(args)
    printstorage(hwpfile)