https://github.com/sumit-behera-in/go-file-compressor
This is a go library used to compress images, videos and documents.
https://github.com/sumit-behera-in/go-file-compressor
compression go golang golang-library zip
Last synced: about 1 year ago
JSON representation
This is a go library used to compress images, videos and documents.
- Host: GitHub
- URL: https://github.com/sumit-behera-in/go-file-compressor
- Owner: sumit-behera-in
- Created: 2024-12-08T12:42:57.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2025-01-12T14:07:37.000Z (over 1 year ago)
- Last Synced: 2025-02-01T23:46:10.637Z (over 1 year ago)
- Topics: compression, go, golang, golang-library, zip
- Language: Go
- Homepage:
- Size: 3.27 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# go-file-compressor
A Go library for compressing images, videos, and documents, featuring a user-friendly CLI interface for seamless interaction. If no output path is provided, the compressed file will be saved to the default download folder of your operating system.
## Features
- **Compress(file File)**: Compress any input file and return the most optimized version, saved as a `.gz` file.
- **ImageCompress(inputFile File)**: Compress image files, returning the compressed result in the same image format.
- **VideoCompress(inputFile File)**: Compress video files, optimizing them for size while retaining quality.
- **CompressBytes(inputData []byte)**: Compress byte data and return the result as a `.gz` compressed file.
- **DecompressBytes(compressedData []byte)**: Decompress `.gz` compressed byte data and return the original file.
## CLI Commands
- `goFileCompressor Compress --file="inputFilePath" [--out="outputFilePath"]`
Compress the file at `inputFilePath`. If no output path (`--out`) is provided, the result will be saved in the default download folder.
- `goFileCompressor Decompress --file="inputFilePath" [--out="outputFilePath"]`
Decompress the `.gz` file at `inputFilePath`. If no output path (`--out`) is specified, the decompressed file will be saved in the default download folder.
## Dependencies
### Runtime Dependencies
- ffmpeg – Required for video compression.
### Buildtime Dependencies
- upx – For executable file compression.
- make – For building the project.
## Disclaimer
During video compression, both the original and the compressed video files are temporarily stored in the temp/ directory. Once the compression process is complete, these files are deleted. To avoid conflicts and potential data loss, please refrain from manually interacting with this directory during compression, as it may overwrite existing files.
## Contributing 💖
We welcome contributions to help improve and expand this library! Whether you're fixing bugs, adding new features, or improving the documentation, your help is greatly appreciated. Made with love by the community, for the community.