Skip to content

Work with .gma (Garrys Mod Addon) files from within your GoLang application

License

Notifications You must be signed in to change notification settings

IPS-Hosting/gma

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GMA Reader

Work with .gma (Garry's Mod Addon) files from withing your GoLang application.

Features

  • Read meta data from a .gma file, including
    • SteamID (author)
    • Timestamp
    • Name
    • Description
    • Type
    • Tags
    • Files
  • Extract the addon to a destination folder using concurrent reads and writes for maximum speed

Installation

go get -u github.com/ips-hosting/gma

Usage

package mypackage

import (
  "os"
  "path/filepath"
  "github.com/ips-hosting/gma"
)

func main() {
  // Open reader to a GMA file
  f, err := os.Open("12345.gma")
  defer f.Close()
  if err != nil {
    // Handle error
  }
  
  // Read gma file
  r := gma.NewReader(f)
  addon, err := r.ReadAddon()
  if err != nil {
    // Handle error
  }
  
  // Access information about addon
  // addon.Name
  // addon.Description
  // addon.Files
  // ...
  
  // Extract content of addon to destination
  dest := filepath.Join(os.TempDir(), "myaddon")
  err = addon.Extract(dest)
  if err != nil {
    // Handle error
  }
}

Credits

Official gmad utility by Facepunch

About

Work with .gma (Garrys Mod Addon) files from within your GoLang application

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages