Skip to content

micromdm/plist

Folders and files

NameName
Last commit message
Last commit date

Latest commit

c0c2f16 · Mar 15, 2025

History

73 Commits
Feb 27, 2025
Jan 21, 2025
Feb 9, 2016
Nov 12, 2024
Dec 2, 2024
Mar 15, 2025
Mar 15, 2025
Nov 27, 2024
Nov 27, 2024
Dec 2, 2024
Dec 2, 2024
Jan 11, 2016
Mar 4, 2016
Jan 21, 2025
Nov 27, 2024

Repository files navigation

Go Plist library

CI/CD Go Reference

This Plist library is used for decoding and encoding Apple Property Lists in both XML and binary forms.

Example using HTTP streams:

func someHTTPHandler(w http.ResponseWriter, r *http.Request) {
	var sparseBundleHeader struct {
		InfoDictionaryVersion *string `plist:"CFBundleInfoDictionaryVersion"`
		BandSize              *uint64 `plist:"band-size"`
		BackingStoreVersion   int     `plist:"bundle-backingstore-version"`
		DiskImageBundleType   string  `plist:"diskimage-bundle-type"`
		Size                  uint64  `plist:"unknownKey"`
	}

    // decode an HTTP request body into the sparseBundleHeader struct
	if err := plist.NewXMLDecoder(r.Body).Decode(&sparseBundleHeader); err != nil {
		log.Println(err)
        return
	}
}

Credit

This library is based on the DHowett go-plist library but has an API that is more like the XML and JSON package in the Go standard library. I.e. the plist.Decoder() accepts an io.Reader instead of an io.ReadSeeker