{"id":17369607,"url":"https://github.com/gomdimapps/lcme","last_synced_at":"2026-01-21T04:02:21.813Z","repository":{"id":257814283,"uuid":"865449673","full_name":"GomdimApps/lcme","owner":"GomdimApps","description":"O LCME é um framework projetado para facilitar a criação e gestão de conteúdo em aplicações web e aplicações de microserviços no Linux.","archived":false,"fork":false,"pushed_at":"2024-10-08T20:21:45.000Z","size":114,"stargazers_count":2,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2024-10-17T04:23:50.259Z","etag":null,"topics":["config","go","linux","microservice","server"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/GomdimApps.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-30T14:49:26.000Z","updated_at":"2024-10-16T13:36:08.000Z","dependencies_parsed_at":null,"dependency_job_id":"569c00ec-14e4-45b8-aa47-86b990b92cc2","html_url":"https://github.com/GomdimApps/lcme","commit_stats":{"total_commits":25,"total_committers":2,"mean_commits":12.5,"dds":"0.040000000000000036","last_synced_commit":"2d6aad930ab359cdb8d5b36c2995b791baeb5c9d"},"previous_names":["gomdimapps/lcme"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GomdimApps%2Flcme","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GomdimApps%2Flcme/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GomdimApps%2Flcme/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/GomdimApps%2Flcme/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/GomdimApps","download_url":"https://codeload.github.com/GomdimApps/lcme/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228483987,"owners_count":17927443,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["config","go","linux","microservice","server"],"created_at":"2024-10-16T00:05:50.438Z","updated_at":"2026-01-21T04:02:21.782Z","avatar_url":"https://github.com/GomdimApps.png","language":"Go","readme":"# LCME (Linux Content Management Engine)\n\n\u003cimg align=\"right\" width=\"159px\" src=\"./system/utils/framework/logo/logo.png\"\u003e\n\n[![Release](https://img.shields.io/github/release/GomdimApps/lcme.svg?style=flat-square)](https://github.com/GomdimApps/lcme/releases/)\n[![Go Reference](https://pkg.go.dev/badge/github.com/GomdimApps/lcme?status.svg)](https://pkg.go.dev/github.com/GomdimApps/lcme?tab=doc)\n\n### **Purpose of the LCME Framework**\n\nLCME is a framework designed to facilitate the creation and management of content in web applications and microservices applications on Linux. It is lightweight and modular, allowing developers to integrate content management functionalities efficiently and scalably.\n\n### **Framework Objective**\n\nThe main objective of LCME is to provide a simple and effective solution for content management, with a special focus on microservices applications developed in Go. The project aims to use the minimum of third-party frameworks, making the application highly native and reducing external dependencies.\n\n### **How LCME Can Help in Go Projects**\n\n1. **Modularity**: The framework is modular, meaning you can choose and integrate only the components necessary for your project, keeping the system lightweight and efficient.\n\n2. **Scalability**: With a lightweight architecture, LCME allows applications to scale efficiently, supporting an increase in content volume without compromising performance.\n\n3. **Customization**: LCME offers a high degree of customization, allowing developers to adapt the framework to the specific needs of the project, whether in the user interface or backend logic.\n\n4. **Nativism**: By minimizing the use of third-party frameworks, LCME ensures that the application remains highly native, which can result in better performance and lower complexity.\n\n5. **Native Interaction with Linux**: LCME facilitates the use and implementation of microservices, bringing native ways to interact with the Linux operating system (Server) within an application, which can be extremely useful for low-level operations and system-specific optimizations.\n\n6. **Documentation and Support**: The repository includes detailed documentation and usage examples, making it easier to learn and implement the framework in new projects.\n\n## How to Add the Framework\n\n```bash\ngo get github.com/GomdimApps/lcme\n```\n\n# Shell\n\nExecutes a Shell command and returns the standard output and an error, if any.\n\n#### Parameters\n\n- **`command`** (string): Shell command to be executed.\n\n#### Returns\n\n- **`string`**: Standard output of the command.\n- **`error`**: Error description, if any.\n\n#### Usage Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tcommand := \"rm -r teste.txt\" // Command to be executed\n\n\tresult, err := lcme.Shell(command)\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err) // Display error, if any\n\t} else {\n\t\tfmt.Println(\"Result:\", result) // Display command output\n\t}\n}\n```\n\n### Behavior\n\n- Returns the command output and `nil` if successful.\n- Returns the output and a descriptive error if the command fails.\n\n---\n\n# ConfigRead\n\nThe `ConfigRead` function is used to load a configuration file (`config.conf`) and populate the `Config` structure with the values read. The configuration file must follow the `key=value` format.\n\n### How to Use:\n\n1. Create a configuration file in the appropriate format (see below).\n2. Call the `ConfigRead` function, passing the file path and the `Config` structure.\n3. The function will populate the structure fields with the values from the file.\n\n### Configuration File Rules\n\n- Each line of the file must be in the `key=value` format.\n- The key name must exactly match the field name in the `Config` structure, respecting case sensitivity.\n- Values must be compatible with the corresponding field type:\n  - For `bool`: Use `true` or `false`.\n  - For `int`, `int64`, `uint64`: Use integer numbers.\n  - For `float32`, `float64`: Use decimal numbers (dot `.` to separate the decimal part).\n  - For `string`: Use any text sequence without spaces around the value.\n  \n- Comments must start with the `#` character and will be ignored.\n\n### Example of the `Config` Structure\n\nBelow is an example of a `Config` structure that can be used with the `ConfigRead` function:\n\n```go\ntype Config struct {\n\tAccessIp       bool\n\tMaxConnections int\n\tPort           int\n\tHostName       string\n\tTimeout        float64\n\tEnableLogs     bool\n\tConnectionID   int64\n\tBufferSize     uint64\n\tResponseTime   float32\n}\n```\n\n#### Example of `config.conf` file:\n\n```\n# Server configurations\nAccessIp=true\nMaxConnections=100\nPort=8080\nHostName=localhost\nTimeout=30.5\nEnableLogs=true\nConnectionID=1234567890\nBufferSize=4096\nResponseTime=0.25\n```\n\n- **Key**: Must exactly match the field name in the `Config` structure.\n- **Value**: Must be compatible with the field type (e.g., `true` or `false` for booleans, numbers for integers and floats, etc.).\n\n### Usage Command in `main`:\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\t\"github.com/GomdimApps/lcme\" \n)\n\ntype Config struct {\n\tAccessIp       bool\n\tMaxConnections int\n\tPort           int\n\tHostName       string\n\tTimeout        float64\n\tEnableLogs     bool\n\tConnectionID   int64\n\tBufferSize     uint64\n\tResponseTime   float32\n}\n\nfunc main() {\n\n\tconfig := Config{}\n\n\terr := lcme.ConfigRead(\"config.conf\", \u0026config)\n\tif err != nil {\n\t\tlog.Fatalf(\"Error loading configuration: %s\", err)\n\t}\n\n\tfmt.Printf(\"AccessIp: %t\\n\", config.AccessIp)\n\tfmt.Printf(\"MaxConnections: %d\\n\", config.MaxConnections)\n\tfmt.Printf(\"Port: %d\\n\", config.Port)\n\tfmt.Printf(\"HostName: %s\\n\", config.HostName)\n\tfmt.Printf(\"Timeout: %.2f\\n\", config.Timeout)\n\tfmt.Printf(\"EnableLogs: %t\\n\", config.EnableLogs)\n\tfmt.Printf(\"ConnectionID: %d\\n\", config.ConnectionID)\n\tfmt.Printf(\"BufferSize: %d\\n\", config.BufferSize)\n\tfmt.Printf(\"ResponseTime: %.2f\\n\", config.ResponseTime)\n}\n```\n\n# getInfoServer\n\nThe `getInfoServer` function is responsible for capturing various system information, such as Linux distribution data, memory, disk, CPU, and network.\n\nIn your Go code, import the `lcme` package and call the `getInfoServer` function to capture server information.\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\t// Capture server information\n\tserverInfo := lcme.GetInfoServer()\n\n\t// Display captured data\n\tfmt.Printf(\"Linux Distribution: %s\\n\", serverInfo.Distribution.Name)\n\tfmt.Printf(\"Total Memory: %d MB\\n\", serverInfo.RAM.Total)\n}\n```\n\n### Distribution Table\n\n| Field                        | Type    | Description                                                                 |\n|------------------------------|---------|---------------------------------------------------------------------------|\n| `Distribution.PrettyName`     | `string`| Human-readable and complete name of the distribution, usually includes name and version. |\n| `Distribution.Name`           | `string`| Name of the distribution, such as \"Debian GNU/Linux\".                            |\n| `Distribution.VersionID`      | `string`| Version ID of the distribution (e.g., \"12\").                                   |\n| `Distribution.Version`        | `string`| Description of the distribution version, usually includes number and codename (e.g., \"12 (bookworm)\"). |\n| `Distribution.VersionCodeName`| `string`| Codename of the distribution version, used internally (e.g., \"bookworm\").  |\n| `Distribution.ID`             | `string`| Unique identifier of the distribution (e.g., \"debian\").                       |\n| `Distribution.HomeURL`        | `string`| URL of the distribution's main website (e.g., \"https://www.debian.org/\").    |\n| `Distribution.SupportURL`     | `string`| URL for obtaining technical support for the distribution (e.g., \"https://www.debian.org/support\"). |\n| `Distribution.BugReportURL`   | `string`| URL for reporting bugs in the distribution (e.g., \"https://bugs.debian.org/\").  |\n\n---\n\n### RAM Table\n\n| Field              | Type    | Description                         |\n|--------------------|---------|-----------------------------------|\n| `RAM.Total`        | `uint64`| Total RAM in megabytes (MB). |\n| `RAM.Used`         | `uint64`| Used RAM in megabytes (MB). |\n| `RAM.Available`    | `uint64`| Available RAM in megabytes (MB). |\n\n---\n\n### Disk Space Table\n\n| Field             | Type    | Description                         |\n|-------------------|---------|-----------------------------------|\n| `Disk.Total`      | `uint64`| Total disk space in megabytes (MB). |\n| `Disk.Used`       | `uint64`| Used disk space in megabytes (MB). |\n| `Disk.Available`  | `uint64`| Available disk space in megabytes (MB). |\n\n---\n\n### CPU Table\n\n| Field              | Type      | Description                        |\n|--------------------|-----------|----------------------------------|\n| `CPU.NumCores`     | `int`     | Total number of processor cores. |\n| `CPU.Usage`        | `float64` | Current processor usage percentage. |\n\n---\n\n### IPv4 Network Table\n\n| Field                       | Type        | Description                                                   |\n|-----------------------------|-------------|-------------------------------------------------------------|\n| `Network.IPv4`               | `[]string`  | List of IPv4 addresses associated with the server.          |\n| `Network.IPv4Ports.TCP.Out`  | `[]string`  | Outgoing (`OUT`) addresses for TCP connections in IPv4.       |\n| `Network.IPv4Ports.TCP.In`   | `[]string`  | Incoming (`IN`) addresses for TCP connections in IPv4.      |\n| `Network.IPv4Ports.TCP.All`  | `[]string`  | Complete TCP connections in IPv4, showing both outgoing and incoming addresses. |\n| `Network.IPv4Ports.UDP.Out`  | `[]string`  | Outgoing (`OUT`) addresses for UDP connections in IPv4.       |\n| `Network.IPv4Ports.UDP.In`   | `[]string`  | Incoming (`IN`) addresses for UDP connections in IPv4.      |\n| `Network.IPv4Ports.UDP.All`  | `[]string`  | Complete UDP connections in IPv4, showing both outgoing and incoming addresses. |\n\n---\n\n### IPv6 Network Table\n\n| Field                       | Type        | Description                                                   |\n|-----------------------------|-------------|-------------------------------------------------------------|\n| `Network.IPv6`               | `[]string`  | List of IPv6 addresses associated with the server.          |\n| `Network.IPv6Ports.TCP.Out`  | `[]string`  | Outgoing (`OUT`) addresses for TCP connections in IPv6.       |\n| `Network.IPv6Ports.TCP.In`   | `[]string`  | Incoming (`IN`) addresses for TCP connections in IPv6.      |\n| `Network.IPv6Ports.TCP.All`  | `[]string`  | Complete TCP connections in IPv6, showing both outgoing and incoming addresses. |\n| `Network.IPv6Ports.UDP.Out`  | `[]string`  | Outgoing (`OUT`) addresses for UDP connections in IPv6.       |\n| `Network.IPv6Ports.UDP.In`   | `[]string`  | Incoming (`IN`) addresses for UDP connections in IPv6.      |\n| `Network.IPv6Ports.UDP.All`  | `[]string`  | Complete UDP connections in IPv6, showing both outgoing and incoming addresses. |\n\n---\n\n### Network Rate Table\n\n| Field                       | Type        | Description                                                   |\n|-----------------------------|-------------|-------------------------------------------------------------|\n| `Network.Download`          | `int64`     | Download rate in kilobytes per second (KBps).           |\n| `Network.Upload`            | `int64`     | Upload rate in kilobytes per second (KBps).             |\n\n### Usage Examples (Network Rate)\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tserverInfo := lcme.GetInfoServer()\n\n\tfmt.Printf(\"Download: %d KB\\n\", serverInfo.Network.Download)\n\tfmt.Printf(\"Upload: %d KB\\n\", serverInfo.Network.Upload)\n}\n```\n\n### Hardware Table\n\n| Field                | Type      | Description                           |\n|----------------------|-----------|---------------------------------------|\n| `Hardware.KernelVersion`  | `string`  | Kernel version of the operating system. |\n| `Hardware.ProcessorName`  | `string`  | Name of the server processor.          |\n| `Hardware.Uptime`         | `int`     | Server uptime in minutes.              |\n| `Hardware.SwapTotal`      | `int`     | Total Swap memory in megabytes (MB).   |\n| `Hardware.SwapFree`       | `int`     | Available Swap memory in megabytes (MB).|\n\n---\n\n### Usage Examples\n\n#### Example 1: Capture and Display Network Information\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tserverInfo := lcme.GetInfoServer()\n\n\t// Display IPv4 addresses\n\tfor _, ip := range serverInfo.Network.IPv4 {\n\t\tfmt.Println(\"Machine IP (IPv4):\", ip)\n\t}\n\n\t// Display IPv6 addresses\n\tfor _, ip := range serverInfo.Network.IPv6 {\n\t\tfmt.Println(\"Machine IP (IPv6):\", ip)\n\t}\n}\n```\n\n#### Example 2: Capture Memory Information\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tserverInfo := lcme.GetInfoServer()\n\n\tfmt.Printf(\"Total Memory: %d MB\\n\", serverInfo.RAM.Total)\n\tfmt.Printf(\"Used Memory: %d MB\\n\", serverInfo.RAM.Used)\n\tfmt.Printf(\"Available Memory: %d MB\\n\", serverInfo.RAM.Available)\n}\n```\n\n---\n\n# GetFolderSize\n\nThe `GetFolderSize` function is used to calculate the size of a specific folder in kilobytes (KB). It recursively traverses all files and subdirectories within the specified directory and sums the size of each file.\n\n### Parameters\n\n- **`path`** (string): Path of the directory whose total file sizes will be calculated.\n\n### Returns\n\n- **`uint64`**: Total size of the folder in kilobytes (KB).\n- **`error`**: Error description, if any. If the user does not have permission to access any file or directory, a permission error will be returned.\n\n### Usage Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tsize, err := lcme.GetFolderSize(\"/root\")\n\tif err != nil {\n\t\tfmt.Printf(\"Error: %v\\n\", err)\n\t} else {\n\t\tfmt.Printf(\"Size of /root: %d KB\\n\", size)\n\t}\n}\n```\n\n### Behavior\n\n- Returns the total size of the folder in kilobytes (KB) if successful.\n- Returns a descriptive error if there is a problem accessing any file or directory, including permission errors.\n\n---\n\n# GetFileInfo\n\nThe `GetFileInfo` function is used to obtain detailed information about specific files in a given directory. It can handle capturing information for both a single file and multiple files.\n\n### Parameters\n- **`dir`** (string): The path of the directory where the files are located.\n- **`files`** (variadic string): One or more file names for which information will be captured.\n\n### FileInfo Table\n\n| Field                | Type         | Description                                      |\n|----------------------|--------------|--------------------------------------------------|\n| `FileName`           | `string`     | Name of the file.                                |\n| `FileSize`           | `int64`      | Size of the file in bytes.                       |\n| `FileLastChange`     | `time.Time`  | Date and time of the last modification of the file. |\n| `FileUserPermission` | `os.FileMode`| User permissions on the file.                    |\n| `FileExtension`      | `string`     | File extension.                                  |\n| `FileData`           | `string`     | Content of the file in string format.            |\n| `FileDataBuffer`     | `bytes.Buffer`| Buffer containing the file data.                 |\n| `FileDir`            | `string`     | Directory where the file is located.             |\n\n### Usage Example\n\n#### Capture information for a single file:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tfileInfos, err := lcme.GetFileInfo(\"/root\", \".bashrc\")\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t\treturn\n\t}\n\n\t// Since we are capturing only one file, we take the first element of the list\n\tfileInfo := fileInfos[0]\n\tfmt.Printf(\"FileName: %s\\n\", fileInfo.FileName)\n\tfmt.Printf(\"FileSize: %d KB\\n\", fileInfo.FileSize)\n\tfmt.Printf(\"FileLastChange: %s\\n\", fileInfo.FileLastChange)\n\tfmt.Printf(\"FileUserPermission: %s\\n\", fileInfo.FileUserPermission)\n}\n```\n\n#### Capture information for multiple files:\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tfiles := []string{\".bashrc\", \"Dockerfile\"}\n\tfileInfos, err := lcme.GetFileInfo(\"/root\", files...)\n\tif err != nil {\n\t\tfmt.Println(\"Error:\", err)\n\t\treturn\n\t}\n\n\tfor _, fileInfo := range fileInfos {\n\t\tfmt.Printf(\"FileName: %s\\n\", fileInfo.FileName)\n\t\tfmt.Printf(\"FileSize: %d KB\\n\", fileInfo.FileSize)\n\t\tfmt.Printf(\"FileLastChange: %s\\n\", fileInfo.FileLastChange)\n\t\tfmt.Printf(\"FileUserPermission: %s\\n\", fileInfo.FileUserPermission)\n\t}\n}\n```\n\nWith this function, you can easily obtain detailed information about specific files in a directory, whether for a single file or multiple files.\n\n---\n\n\n# Log\n\nThe `Log` function is designed to record messages in a log file. This is useful for keeping a record of activities or events that occur in a program.\n\n### How to Use\n\n```go\npackage main\n\nimport (\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tlogger := lcme.Log(\"log.txt\")\n\n\t// Log messages\n\tlogger(\"First log message\")\n\tlogger(\"Second log message\")\n\tlogger(\"Third log message\")\n}\n```\n\n### Steps to Use the `Log` Function:\n\n1. **Specify the Log File Path:**\n\t```go\n\tlogger := lcme.Log(\"log.txt\")\n\t```\n\tHere, `lcme.Log(\"log.txt\")` initializes the function to add messages to the `log.txt` file.\n\n2. **Record Messages in the Log File:**\n\t```go\n\tlogger(\"First log message\")\n\tlogger(\"Second log message\")\n\tlogger(\"Third log message\")\n\t```\n\tEach call to `logger` adds a new line to the `log.txt` file with the provided message.\n\n# MonitorNetworkRates\n\nThe `MonitorNetworkRates` function is used to continuously monitor the download and upload rates of the active network interface. It returns a channel through which the network rates are periodically sent.\n\n### Usage Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\tratesChannel := lcme.MonitorNetworkRates()\n\n\tfor rate := range ratesChannel {\n\t\tfmt.Printf(\"Download: %d KB, Upload: %d KB\\n\", rate.Download, rate.Upload)\n\t}\n}\n```\n\n---\n\n# ScaleFork\n\nThe `ScaleFork` function is capable of scaling the execution of a task, managing its execution.\n\n### Usage Example\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\n\t\"github.com/GomdimApps/lcme\"\n)\n\nfunc main() {\n\t// Execute the task using the ScaleFork function\n\tlcme.ScaleFork(func() {\n\t\t// Simulate a long-running operation\n\t\tfmt.Println(\"Task completed\")\n\t})\n}\n```\n\n### Benefits\n\nThis function offers several benefits, especially for those looking to manage and scale the processing of asynchronous tasks. Here are some of the main benefits:\n\n1. **Scalability:**\n\t- The function allows dynamically scaling the number of workers according to the task demand. This ensures the system can handle load spikes without interruptions.\n\n2. **Efficient Task Management:**\n\t- Using goroutines, the function can execute multiple tasks in parallel, increasing efficiency and processing speed.\n\n### Usage Examples\n\n- **Batch Processing:** Ideal for systems that need to process large volumes of data in batches, such as image processing systems or data analysis.\n- **Queue Systems:** Can be used as a basis for a queue system where different tasks need to be queued and executed asynchronously.\n- **Web Applications:** Can serve as a backend for web applications that require background processing, such as sending emails, push notifications, etc.\n\n---\n\n# Compressing Files\n\nThis function compresses files in a simple and fast way.\n\n### Usage Examples\n\n```go\npackage main\n\nimport (\n\t\"fmt\"\n\t\"log\"\n\n\t\"github.com/GomdimApps/lcme\"\n\t// Ensure the threads package is imported\n)\n\nfunc main() {\n\t// ===== Example 1: Compressing a list of files =====\n\tfiles := []string{\"file1.txt\", \"file2.txt\"}\n\tzipFileForFiles := \"./test/files.zip\"\n\ttarGzFileForFiles := \"./test/files.tar.gz\"\n\n\tif err := lcme.ZipFiles(zipFileForFiles, files); err != nil {\n\t\tlog.Println(\"Error compressing files into ZIP:\", err)\n\t} else {\n\t\tfmt.Println(\"Files successfully compressed into ZIP!\")\n\t}\n\n\tif err := lcme.TarGzFiles(tarGzFileForFiles, files); err != nil {\n\t\tlog.Println(\"Error compressing files into TAR.GZ:\", err)\n\t} else {\n\t\tfmt.Println(\"Files successfully compressed into TAR.GZ!\")\n\t}\n\n\t// ===== Example 2: Compressing an entire folder =====\n\tfolder := \"./test\"\n\tzipFileForFolder := \"./test/folder.zip\"\n\ttarGzFileForFolder := \"./test/folder.tar.gz\"\n\n\tif err := lcme.ZipFolder(zipFileForFolder, folder); err != nil {\n\t\tlog.Println(\"Error compressing folder into ZIP:\", err)\n\t} else {\n\t\tfmt.Println(\"Folder successfully compressed into ZIP!\")\n\t}\n\n\tif err := lcme.TarGzFolder(tarGzFileForFolder, folder); err != nil {\n\t\tlog.Println(\"Error compressing folder into TAR.GZ:\", err)\n\t} else {\n\t\tfmt.Println(\"Folder successfully compressed into TAR.GZ!\")\n\t}\n}\n```\n\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgomdimapps%2Flcme","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgomdimapps%2Flcme","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgomdimapps%2Flcme/lists"}