pathcodec

package module
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 2025 License: MIT Imports: 2 Imported by: 0

README

pathcodec

Go Version License MIT GoDoc Go Report Card

A lightweight Go package for compressing and decompressing Telegram vector thumbnails.

Installation

go get -u github.com/itpey/pathcodec

Usage

package main

import (
	"fmt"
	"github.com/itpey/pathcodec"
)

func main() {
	compressed, err := pathcodec.Compress("M257,455c-56,0-109-25-146-65-143-156,31-397,224-318,201,83,136,386-78,383z")
	if err != nil {
		fmt.Println("Compression error:", err)
		return
	}
	fmt.Println("Compressed:", compressed)

	decompressed, err := pathcodec.Decompress(compressed)
	if err != nil {
		fmt.Println("Decompression error:", err)
		return
	}
	fmt.Println("Decompressed:", decompressed)
}

API

func Compress(path string) ([]byte, error)

Compresses a path string into a compact byte format. The input must start with 'M' and end with 'z'.

func Decompress(encoded []byte) (string, error)

Decompresses a byte slice back into a path string.

Feedback and Contributions

If you encounter any issues or have suggestions for improvement, please open an issue on GitHub.

We welcome contributions! Fork the repository, make your changes, and submit a pull request.

License

pathcodec is open-source software released under the MIT License. You can find a copy of the license in the LICENSE file.

Author

pathcodec was created by itpey

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compress

func Compress(path string) ([]byte, error)

func Decompress

func Decompress(encoded []byte) (string, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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