Code Monkey home page Code Monkey logo

destream's Introduction

Test destream codecov PyPI PyPI - Python Version

destream

destream: decompress a stream

Compatibility

  • Python: 3.6, 3.7, 3.8, 3.9
  • OS:
    • Linux
    • OSX
    • Windows is not tested and requires file and libmagic for Windows

Installation

pip install destream OR easy_install --user destream

Usage

  1. Decompress multiple files of anytype to directory:

    destream -o /tmp/output_dir file1.zip file2.rar file3.7z file4.tar.bz2
  2. Decompress any stream to the current folder:

    wget -O - "https://github.com/cecton/destream/archive/3.1.tar.gz" | destream -o ./
  3. Decompress any compressed file to stdout:

    destream documentation.gz | less

Lib Usage

  1. Open an archive that holds multiple files (aka: ArchivePack)
    archive = destream.open("some_file.tar.gz")
    
    assert (isinstance(archive, destream.ArchivePack) and
           isinstance(archive.tarfile, tarfile.TarFile))
    
    # ==> we can extract members using extract() and extractall()
    archive.extractall("/tmp")
  2. Open a compressed file (or stream) and get an uncompressed stream
    archive = destream.open("weird_file.bz2.gz")
    
    assert isinstance(archive, destream.Archive)
    
    # ==> we can read the content but not seek
    print(archive.read())
  3. Open an archive that holds only one file,
    archive = destream.open("some_file.tar.xz")
    
    # ==> we can read the archive like it is a stream
    if archive.single():
        print(archive.read())
    else:
        archive.extractall('/tmp/some/path/')

Troubleshooting

  • ImportError: failed to find libmagic. Check your installation

    • Mac OS X: follow these installation guide. Or simply:

      brew install libmagic
      
    • Arch Linux:

      pacman -S file
      
    • Ubuntu/Debian:

      apt-get install libmagic1
      
  • LZMA does not work

    Check your version of file and libmagic. It's working on version 5.22 and greater but not on version 5.14 and lower.

  • Zstd does not work

    Check your version of file and libmagic. It's working on version 5.32 and greater but not on version 5.25 and lower.

  • ZIP files fails to extract

    If you have libmagic version 5.39 (released 2020-06-16), this version does not identify ZIP file v2.0 correctly. This bug in libmagic has been reported. Install the previous version 5.38 if you can.

destream's People

Contributors

cecton avatar eumiro avatar jruere avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

tml

destream's Issues

Codecov not working anymore

I think it probably broke when I moved the repository.

I tried to re-enable it but it has difficulties to find the organization for some reason.

Maybe someone else can give it a try?

Suggestions to improve this repository

Hello everyone,

destream is a creation of mine and I started it when I didn't have much experience in open source projects. I have recently improved the quality of this repo by using semantic versioning and fixing the thread related issue.

If you have any idea on how to improve the quality of this product (automatic delivery, coverage, testing, better classes, naming convention... anything) feel free to propose changes.

I need you more than you need me, especially since I don't even use this library anymore for now.

Best

Looking for maintainers

Hi everyone ๐Ÿ‘‹

I am glad that this project helped some people managing archives. Unfortunately it is now time for me to move on. One of the main reason is that I didn't have a use for this library for a very long time now. Another reason is that I don't use much Python anymore either.

I believe a team of interested people can bring this project to the next level with more features, better code quality and better stability and tests.

That's why I think this project should go back to the community. I would like to create an organization with a few maintainers and owners for it. The more the merrier. If you are interested in adopting destream, please let me know.

Kind regards and thank you for your interest

cc @jruere @ziord @gauravssnl @luenix @ayoshi @Phyllostachys @shekkbuilder @Meroje

Add an .editorconfig

I don't know if it is possible but it would be nice to have a GitHub Actions enforcing it on the PR so it will give less work to the maintainers.

Converting tests to pytests discovers duplicated test code

During the attempt to convert the test suite to PyTest, I have discovered, that the two tests:

  • test_10_passing_file_object
  • test_20_passing_filename

from

def test_10_passing_file_object(self):
text = b"Hello World!\n"
with TemporaryFile() as fileobj:
fileobj.write(text)
fileobj.flush()
archive = ArchiveFile(fileobj=fileobj)
self._regular_tests(archive, fileobj, fileobj.name, text)
def test_20_passing_filename(self):
text = b"Hello World!\n"
with TemporaryFile() as fileobj:
fileobj.write(text)
fileobj.flush()
archive = ArchiveFile(fileobj=fileobj)
self._regular_tests(archive, fileobj, fileobj.name, text)

were identical. What should be the difference between them, @cecton ?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.