GithubHelp home page GithubHelp logo

nikonov1101 / dcompress Goto Github PK

View Code? Open in Web Editor NEW

This project forked from hotei/dcompress

2.0 0.0 0.0 13 KB

go package to decompress files with .Z (Unix compress) extension, golang

Go 100.00%

dcompress's Introduction

# dcompress

OVERVIEW

dcompress is a go (1.4.2 currently) package to decompress .Z files.

This is a conversion literal translation of (n)compress42.c into go. The original program was a Unix utility to compress/dcompress files. Files compressed with this utility have a .Z extension. It's relatively rare as of 2015 since better compression utilities are available now.

WHY?

I converted this utility to go so I could use it with a program I wrote to look inside tar and zip archives and gather data on the files therein. Some of the files in my tars are in .Z format and are themselves tars (ie tarofsomedir.tar.Z. I could of course have uncompressed them manually, but that's not what programmers do.

Installation

If you have a working go installation on a Unix-like OS:

go get github.com/hotei/dcompress

Will copy github.com/hotei/program to the first entry of your $GOPATH

or if go is not installed yet :

cd DestinationDirectory

git clone https://github.com/hotei/dcompress.git

Features

  • Designed to decompress files with .Z extension ('compress' output)
  • Same interface as the other packages in the go stdlib compress directory (flate,bzip2 etc)

Limitations

  • package is read only, there is no plan modify it to write .Z files (gz and bz2 are much better)

Comments can be sent to [email protected] or registered at github.com/hotei/dcompress

Things to be aware of

  • Passes test suite with input of 9 KB, 500 KB and 22 MB in 0.75 seconds (4Ghz AMD64).
  • It will not work with .z extension (that would be the output from pack , not compress)
  • Has not been tested on 32bit hardware due to lack of time/need/availability.
  • The software uses LZW.
  • LZW aka the Lempel-Ziv-Welch algorithm was patented. That patent (US Patent 4,558,302) has expired in the US.
  • I have no plans for a function to create compressed files (with ext.Z). If you are interested in one, see http://golang.org/pkg/compress/lzw/ for an LZW reader/writer.
  • It is my impression from reading the documentation that the package compress/lzw only decodes up to 12 bit codes (const maxWidth=12). The Unix compress utility uses up to 16 bit codes according to the documentation.

Typical usage to read a compressed file can be found in the example directory.

License

The 'dcompress' go package is distributed under the Simplified BSD License:

Copyright (c) 2015 David Rook. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Documentation (c) 2015 David Rook

// EOF README-dcompress.md (this is a markdown document and tested OK with blackfriday)

dcompress's People

Contributors

hotei avatar

Stargazers

 avatar  avatar

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.