Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/groob/plist
Go Plist library
https://github.com/groob/plist
Last synced: 30 days ago
JSON representation
Go Plist library
- Host: GitHub
- URL: https://github.com/groob/plist
- Owner: groob
- License: other
- Created: 2016-01-02T05:46:45.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2023-02-05T18:49:10.000Z (almost 2 years ago)
- Last Synced: 2024-08-04T02:10:23.516Z (3 months ago)
- Language: Go
- Size: 82 KB
- Stars: 49
- Watchers: 3
- Forks: 13
- Open Issues: 14
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# OS X XML Plist library for Go
![Go](https://github.com/groob/plist/workflows/Go/badge.svg)The plist library is used for decoding and encoding XML Plists, usually from HTTP streams.
Example:
```
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 of [DHowett's](https://github.com/DHowett/go-plist) library but has an API that's more similar to the XML and JSON libraries in the standard library. The plist.Decoder() accepts an `io.Reader` instead of an `io.ReadSeeker`