lzss

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2020 License: MIT Imports: 1 Imported by: 3

README

lzss

GoDoc License

LZSS compression package for Go.


Install

go get github.com/blacktop/lzss

Examples

import (
    "io/ioutil"
    "log"

    "github.com/blacktop/lzss"
    "github.com/pkg/errors"
)

func main() {
    dat, err := ioutil.ReadFile("compressed.bin")
    if err != nil {
        log.Fatal(errors.Wrap(err, "failed to read compressed file"))
    }

    decompressed := lzss.Decompress(dat)
    err = ioutil.WriteFile("compressed.bin.decompressed", decompressed, 0644)
    if err != nil {
        log.Fatal(errors.Wrap(err, "failed to decompress file"))
    }
}

NOTE: I believe lzss expects the data to be word aligned.

Credit

Converted to Golang from BootX-81//bootx.tproj/sl.subproj/lzss.c

TODO

  • add Compress func

License

MIT Copyright (c) 2018 blacktop

Documentation

Overview

Package lzss is a LZSS compression package for Go.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decompress

func Decompress(src []byte) []byte

Decompress decompresses lzss data

Types

type Header struct {
	CompressionType  uint32 // 0x636f6d70 "comp"
	Signature        uint32 // 0x6c7a7373 "lzss"
	CheckSum         uint32 // Likely CRC32
	UncompressedSize uint32
	CompressedSize   uint32
	Padding          [padding]byte
}

Header represents the LZSS header

Jump to

Keyboard shortcuts

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