Skip to content

1ec5/node-vcf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VCF / vCard

npm npm downloads build status

Install via npm

$ npm install vcf

Usage

var vCard = require( 'vcf' )

Parsing a string or buffer:

// 'data' being either a string or a buffer
// or something that can be turned into a string
// and represents vcard data
var card = new vCard( data )
// OR
var card = vCard.parse( data )

Stringify:

var str = card.toString()
// OR with version number (doesn't work, yet)
var str = card.toString( '4.0' )

Example output:

{
  version: '4.0',
  n: {
    data: 'Gump;Forrest;;;'
  },
  fn: 'Forrest Gump',
  org: {
    data: 'Bubba Gump Shrimp Co.'
  },
  title: {
    data: 'Shrimp Man'
  },
  photo: {
    data: 'http://www.example.com/dir_photos/my_photo.gif'
  },
  tel: [{
    type: ['work', 'voice'],
    value: 'uri',
    data: 'tel:+1-111-555-1212'
  }, {
    type: ['home', 'voice'],
    value: 'uri',
    data: 'tel:+1-404-555-1212'
  }],
  adr: {
    type: 'work',
    label: '42 Plantation St.\\nBaytown, LA 30314\\nUnited States of America',
    data: ';;42 Plantation St.;Baytown;LA;30314;United States of America'
  },
  email: {
    data: '[email protected]'
  }
}

About

A not so forgiving vCard / vcf parser

Resources

License

Stars

Watchers

Forks

Packages

No packages published