emersion / go-vcard

A Go library to parse and format vCard
MIT License
107 stars 34 forks source link
contacts vcard

go-vcard

Go Reference builds.sr.ht status

A Go library to parse and format vCard.

Usage

f, err := os.Open("cards.vcf")
if err != nil {
    log.Fatal(err)
}
defer f.Close()

dec := vcard.NewDecoder(f)
for {
    card, err := dec.Decode()
    if err == io.EOF {
        break
    } else if err != nil {
        log.Fatal(err)
    }

    log.Println(card.PreferredValue(vcard.FieldFormattedName))
}

License

MIT