kognit

package module
v0.0.0-...-44cdad8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 1, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

README

Kognit

Kognit is a tool developed for the sake of self development regarding file compression and the Go programming language.

Features

  • Directory compression
    • Zip
    • Tar with gzip
  • File compression
    • Flate
    • Deflate
    • gzip
    • Huffman
    • LZW
    • RLE
  • Image compression
    • JPEG
    • JPEG2000
    • PNG
    • GIF
  • Sound compression

Usage

For now this tool can be used as an importable package with already some of its features implemented

To compress a directory's contents you can do:

package main

import (
    "github.com/csothen/kognit"
)

func main(){
    // Will encode the directory into a zip file
    if err := kognit.ZIP.Encode("myDir"); err != nil {
        panic(err)
    }

    // Will decode the zip file
    if err := kognit.ZIP.Decode("myDir.zip"); err != nil {
      panic(err)
    }
}

All future features should follow the same usage flow:

  • Define what type of compression you wish to perform by selecting it from the kognit package
  • Call its Encode method to compress the data
  • Call its Decode method when you want to decompress the data

Future development

For the tools future it is intended that it can be used as:

  • An importable package (in progress)
  • A command line interface (to do)
  • The backend for a web application (to do)

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CompressionAlgorithm

type CompressionAlgorithm interface {
	Encode(src string) error
	Decode(src string) error
}

type DirectoryCompressionAlgorithm

type DirectoryCompressionAlgorithm int
const (
	ZIP DirectoryCompressionAlgorithm = iota
	TAR
)

func (DirectoryCompressionAlgorithm) Decode

func (DirectoryCompressionAlgorithm) Encode

type FileCompressionAlgorithm

type FileCompressionAlgorithm int
const (
	Flate FileCompressionAlgorithm = iota
	Deflate
	Gzip
	Huffman
	LZW
	RLE
)

func (FileCompressionAlgorithm) Decode

func (a FileCompressionAlgorithm) Decode(dataPath string) error

func (FileCompressionAlgorithm) Encode

func (a FileCompressionAlgorithm) Encode(dataPath string) error

type ImageCompressionAlgorithm

type ImageCompressionAlgorithm int
const (
	JPEG ImageCompressionAlgorithm = iota
	JPEG2000
	PNG
	GIF
)

func (ImageCompressionAlgorithm) Decode

func (a ImageCompressionAlgorithm) Decode(dataPath string) error

func (ImageCompressionAlgorithm) Encode

func (a ImageCompressionAlgorithm) Encode(dataPath string) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL