gabagool

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Jun 22, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress added in v0.0.3

func Compress(data string) (string, error)

func Decompress added in v0.0.3

func Decompress(data string) (string, error)

Types

type DataTypes

type DataTypes int
const (
	Bytes DataTypes = iota // data stored is an array of bytes
	Text                   // data stored is a string
	Image                  // data stored is an image, as an array of pixels that are compatible with the go image package
)

type FileCache

type FileCache struct {
	Path     string
	FileData GabagoolFile
}

Cache of the last file opened, usefull for saving on syscalls

This is an internal component and should not be used directly

type GabagoolFile

type GabagoolFile struct {
	Header    uint64    // header for veryfying the file
	Timestamp uint64    // timestamp when the file was created
	Hash      []byte    // sha256 hash of the data in the file
	DataType  DataTypes // type of the data stored in the file
	Length    uint32    // length of the data section
	Data      []byte    // data stored
}

Structure of the Gabagool™️ file, also houses all of it's methods

func (*GabagoolFile) CreateAndSave

func (g *GabagoolFile) CreateAndSave(path string, dataType DataTypes, data []byte) error

The same as calling CreateFile() followed by Save()

func (*GabagoolFile) CreateFile

func (g *GabagoolFile) CreateFile(dataType DataTypes, data []byte) (*GabagoolFile, error)

Creates a new file with the data provided and returns it for use

func (*GabagoolFile) Open

func (g *GabagoolFile) Open(path string) (*GabagoolFile, error)

Opens the files from the provided path and returns it

func (*GabagoolFile) OpenWithBitPacking added in v0.0.2

func (g *GabagoolFile) OpenWithBitPacking(path string) (*GabagoolFile, error)

SaveWithBitPacking opens a bit packed gabagool file

func (*GabagoolFile) ParseFile

func (g *GabagoolFile) ParseFile(path string) (*GabagoolFile, error)

Same as Open() with extra checks to make sure the file is valid

func (*GabagoolFile) Save

func (g *GabagoolFile) Save(path string, file *GabagoolFile) error

Saves the file to the provided path

func (*GabagoolFile) SaveWithBitPacking added in v0.0.2

func (g *GabagoolFile) SaveWithBitPacking(path string, file *GabagoolFile) error

SaveWithBitPacking saves the gabagool file with bit packing

admitedly does not seem to do anything

Jump to

Keyboard shortcuts

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