GithubHelp home page GithubHelp logo

jeff-ding / file-compressor Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 7 KB

Command line utility for losslessly encoding and decoding files into/from compressed codes of user-specified bit-length, based on the Lempel–Ziv–Welch algorithm.

Makefile 1.35% C 98.65%

file-compressor's Introduction

File Compressor

Command line utility for losslessly encoding and decoding input and files into/from compressed codes of user-specified bit-length, based on the Lempel–Ziv–Welch algorithm (http://www.cs.duke.edu/courses/spring03/cps296.5/papers/welch_1984_technique_for.pdf).

Usage

encode [-m MAXBITS | -o NAME | -i NAME | -p USED]*

decode [-o NAME]*

Description

encode reads a stream of characters from the standard input, compresses it using the Lempel-Ziv-Welch algorithm, and writes the stream of codes to the standard output as a stream of bits packed into 8-bit bytes. decode reads from the standard input a byte stream written by encode, decompresses the stream of codes, and writes the stream of characters to the standard output.

encode writes codes using the smallest number of bits required to specify valid codes at the time (e.g., 9 bits when there are 512 valid codes, but 10 bits once the next code is assigned), up to a maximum of 12 bits (or MAXBITS if the -m flag is specified). In effect, this limit determines the maximum size of the string table.

Flags

With the -o NAME option, the final string table (without usage counts) is dumped (in some reasonably compact format) to the file NAME after stdin is processed.

With the -i NAME option, the initial string table is read from the file NAME (which must have been written during a previous execution of encode or decode) rather than consisting of only the one-character strings.

When all possible codes have been assigned, the default is to stop assigning codes. However, with the -p (pruning) option, encode and decode instead create a new string table containing:

  • every one-character string;
  • every string that was found at least USED times (i.e., encountered during encode's greedy search or decode's printing of the string)
  • every nonempty prefix of a string in the table.

file-compressor's People

Contributors

jeff-ding avatar

Watchers

 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.