Skip to content
/ vdf Public

πŸ“ƒ Package for working with Valve Data Format (key value)

Notifications You must be signed in to change notification settings

blukai/vdf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

5 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Valve Data Format

Package for working with Valve Data Format writen in Go. Lexer based on Rob Pike's talk.

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 get github.com/blukai/vdf
  1. Import it in your code:
import "github.com/blukai/vdf"
  1. Parse VDF file:
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:

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.

About

πŸ“ƒ Package for working with Valve Data Format (key value)

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages