Skip to content

DarshD22/File_Archiver

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Huffman Coding File Archiver

Self-made C++ file archiver and archive extractor programs based on Huffman's lossless compression algorithm

How does it work?

Compressor:

The Compressor is a 2-pass program. What I mean by this is that the Compressor reads input files 2 times.

In the first pass, the program counts usage frequency of every unique byte and creates a weighted translation tree for every used unique byte inversely proportional to its usage frequency and then writes this transformation info to the compressed file for decompression purposes

In the second pass, the program translates input files according to the translation tree and writes it to the newly created compressed file

Decompressor:

The Decompressor is a 1-pass program: The Decompressor first reads translation info and creates a binary tree from it. After this process is done, it uses this binary translation tree to decode the rest of the file

How does one use it?

  1. Run below script using your favourate shell:
    chmod u+x Huffman.sh
    ./Huffman.sh
  1. After running the script, you can use archive command below to compress the file you want:
  • To compress one file use:
    ./archive {{filename}}
  • To compress multiple files use:
    ./archive {{filename1}} {{filename2}} ...
  1. And to decompress a compressed file, use the extract command below:
    ./extract {{filename}}

Shortcomings

  • Compressor.cpp does not compress folders

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published