Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/blukai/vdf
📃 Package for working with Valve Data Format (key value)
https://github.com/blukai/vdf
key-value lexer parser steam valve vdf
Last synced: 3 days ago
JSON representation
📃 Package for working with Valve Data Format (key value)
- Host: GitHub
- URL: https://github.com/blukai/vdf
- Owner: blukai
- Created: 2017-07-28T14:22:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2017-07-28T20:10:41.000Z (over 7 years ago)
- Last Synced: 2025-01-21T19:44:33.050Z (8 days ago)
- Topics: key-value, lexer, parser, steam, valve, vdf
- Language: Go
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Valve Data Format
Package for working with [Valve Data Format](https://developer.valvesoftware.com/wiki/KeyValues) writen in Go. Lexer based on Rob Pike's [talk](https://youtu.be/HxaD_trXwRE).###### I found some already existed parsers written in Go, but I did not like them and I decided to write my own.
## Start using it
1. Download and install it:
```go
go get github.com/blukai/vdf
```
2. Import it in your code:
```go
import "github.com/blukai/vdf"
```
3. Parse VDF file:
```go
dat, err := ioutil.ReadFile("./vdfFile.txt")
if err != nil {
log.Fatal(err)
}
m := vdf.Parse(string(dat))
```
...and u can easily convert it's to json by adding:
```go
jsonized, err := json.MarshalIndent(m, "", " ")
if err != nil {
log.Fatal(err)
}err = ioutil.WriteFile("./jsonFile.json", jsonized, 0644)
if err != nil {
log.Fatal(err)
}
```---
If you found a bug, pr's are welcome, otherwise open an issue.