https://github.com/itpey/pathcodec
Go package for compressing and decompressing Telegram vector thumbnails.
https://github.com/itpey/pathcodec
animation dotlottie go golang lottie lottie-animation placeholder svg svg-path telegram tg tgs vector
Last synced: about 2 months ago
JSON representation
Go package for compressing and decompressing Telegram vector thumbnails.
- Host: GitHub
- URL: https://github.com/itpey/pathcodec
- Owner: itpey
- License: mit
- Created: 2025-04-01T21:14:10.000Z (6 months ago)
- Default Branch: main
- Last Pushed: 2025-04-01T22:23:44.000Z (6 months ago)
- Last Synced: 2025-04-01T22:31:02.568Z (6 months ago)
- Topics: animation, dotlottie, go, golang, lottie, lottie-animation, placeholder, svg, svg-path, telegram, tg, tgs, vector
- Language: Go
- Homepage: https://github.com/itpey/pathcodec
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# pathcodec
[![Go Version][GoVer-Image]][GoDoc-Url] [![License MIT][License-Image]][License-Url] [![GoDoc][GoDoc-Image]][GoDoc-Url] [![Go Report Card][ReportCard-Image]][ReportCard-Url]
[GoVer-Image]: https://img.shields.io/badge/Go-1.24%2B-blue
[GoDoc-Url]: https://pkg.go.dev/github.com/itpey/pathcodec
[GoDoc-Image]: https://pkg.go.dev/badge/github.com/itpey/pathcodec.svg
[ReportCard-Url]: https://goreportcard.com/report/github.com/itpey/pathcodec
[ReportCard-Image]: https://goreportcard.com/badge/github.com/itpey/pathcodec?style=flat
[License-Url]: https://github.com/itpey/pathcodec/blob/main/LICENSE
[License-Image]: https://img.shields.io/github/license/itpey/pathcodecA lightweight Go package for compressing and decompressing
[Telegram vector thumbnails](https://core.telegram.org/api/files#vector-thumbnails).## Installation
```sh
go get -u github.com/itpey/pathcodec
```## Usage
```go
package mainimport (
"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](https://github.com/itpey/pathcodec/issues) 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](https://github.com/itpey/pathcodec/blob/main/LICENSE) file.
## Author
pathcodec was created by [itpey](https://github.com/itpey)