{"id":13583762,"url":"https://github.com/enesser/vCards-js","last_synced_at":"2025-04-06T21:32:54.922Z","repository":{"id":23935943,"uuid":"27317227","full_name":"enesser/vCards-js","owner":"enesser","description":"Create vCards to import contacts into Outlook, iOS, Mac OS, and Android devices from your website or application.","archived":false,"fork":false,"pushed_at":"2024-05-27T15:02:11.000Z","size":78,"stargazers_count":436,"open_issues_count":38,"forks_count":159,"subscribers_count":15,"default_branch":"master","last_synced_at":"2025-03-31T16:13:01.006Z","etag":null,"topics":["android","ios","javascript","outlook","react","react-native","vcard","vcards-js"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/enesser.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-29T22:36:29.000Z","updated_at":"2025-02-19T11:38:58.000Z","dependencies_parsed_at":"2024-06-18T12:40:56.311Z","dependency_job_id":"06b669a9-f6b2-4049-bc04-d964adf51c01","html_url":"https://github.com/enesser/vCards-js","commit_stats":{"total_commits":81,"total_committers":10,"mean_commits":8.1,"dds":"0.16049382716049387","last_synced_commit":"99a298c72d3cf31741eaa39e9c66df973e9fec91"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enesser%2FvCards-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enesser%2FvCards-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enesser%2FvCards-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/enesser%2FvCards-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/enesser","download_url":"https://codeload.github.com/enesser/vCards-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247556371,"owners_count":20957960,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["android","ios","javascript","outlook","react","react-native","vcard","vcards-js"],"created_at":"2024-08-01T15:03:45.955Z","updated_at":"2025-04-06T21:32:54.545Z","avatar_url":"https://github.com/enesser.png","language":"JavaScript","readme":"vCards JS\n=====\n\n[![Build Status](https://travis-ci.org/enesser/vCards-js.svg?branch=master)](https://travis-ci.org/enesser/vCards-js.svg?branch=master)\n\nCreate vCards to import contacts into Outlook, iOS, Mac OS, and Android devices from your website or application.\n\n![Screenshot](https://cloud.githubusercontent.com/assets/5659221/5240131/f99c1f3e-78c1-11e4-83b1-4f6e70eecf65.png)\n\n## Install\n\n```sh\nnpm install vcards-js --save\n```\n\n## Usage\n\nBelow is a simple example of how to create a basic vCard and how to save it to a file, or view its contents from the console.\n\n### Basic vCard\n\n```js\nvar vCardsJS = require('vcards-js');\n\n//create a new vCard\nvar vCard = vCardsJS();\n\n//set properties\nvCard.firstName = 'Eric';\nvCard.middleName = 'J';\nvCard.lastName = 'Nesser';\nvCard.organization = 'ACME Corporation';\nvCard.photo.attachFromUrl('https://avatars2.githubusercontent.com/u/5659221?v=3\u0026s=460', 'JPEG');\nvCard.workPhone = '312-555-1212';\nvCard.birthday = new Date(1985, 0, 1);\nvCard.title = 'Software Developer';\nvCard.url = 'https://github.com/enesser';\nvCard.note = 'Notes on Eric';\n\n//save to file\nvCard.saveToFile('./eric-nesser.vcf');\n\n//get as formatted string\nconsole.log(vCard.getFormattedString());\n\n```\n\n### On the Web\n\nYou can use vCards JS on your website. Below is an example of how to get it working on Express 4.\n\n```js\n\nvar express = require('express');\nvar router = express.Router();\n\nmodule.exports = function (app) {\n  app.use('/', router);\n};\n\nrouter.get('/', function (req, res, next) {\n\n    var vCardsJS = require('vcards-js');\n\n    //create a new vCard\n    var vCard = vCardsJS();\n\n    //set properties\n    vCard.firstName = 'Eric';\n    vCard.middleName = 'J';\n    vCard.lastName = 'Nesser';\n    vCard.organization = 'ACME Corporation';\n\n    //set content-type and disposition including desired filename\n    res.set('Content-Type', 'text/vcard; name=\"enesser.vcf\"');\n    res.set('Content-Disposition', 'inline; filename=\"enesser.vcf\"');\n\n    //send the response\n    res.send(vCard.getFormattedString());\n});\n\n```\n\n### Embedding Images\n\nYou can embed images in the photo or logo field instead of linking to them from a URL using base64 encoding.\n\n```js\n//can be Windows or Linux/Unix path structures, and JPEG, PNG, GIF formats\nvCard.photo.embedFromFile('/path/to/file.png');\nvCard.logo.embedFromFile('/path/to/file.png');\n```\n\n```js\n//can also embed images via base-64 encoded strings\nvCard.photo.embedFromString('iVBORw0KGgoAAAANSUhEUgAAA2...', 'image/png');\nvCard.logo.embedFromString('iVBORw0KGgoAAAANSUhEUgAAA2...', 'image/png');\n```\n\n### Date Reference\n\nMDN reference on how to use the `Date` object for birthday and anniversary can be found at [https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date).\n\n### Complete Example\n\nThe following shows a vCard with everything filled out.\n\n```js\nvar vCardJS = require('vcards-js');\n\n//create a new vCard\nvar vCard = vCardsJS();\n\n//set basic properties shown before\nvCard.firstName = 'Eric';\nvCard.middleName = 'J';\nvCard.lastName = 'Nesser';\nvCard.uid = '69531f4a-c34d-4a1e-8922-bd38a9476a53';\nvCard.organization = 'ACME Corporation';\n\n//link to image\nvCard.photo.attachFromUrl('https://avatars2.githubusercontent.com/u/5659221?v=3\u0026s=460', 'JPEG');\n\n//or embed image\nvCard.photo.attachFromUrl('/path/to/file.jpeg');\n\nvCard.workPhone = '312-555-1212';\nvCard.birthday = new Date(1985, 0, 1);\nvCard.title = 'Software Developer';\nvCard.url = 'https://github.com/enesser';\nvCard.workUrl = 'https://acme-corporation/enesser';\nvCard.note = 'Notes on Eric';\n\n//set other vitals\nvCard.nickname = 'Scarface';\nvCard.namePrefix = 'Mr.';\nvCard.nameSuffix = 'JR';\nvCard.gender = 'M';\nvCard.anniversary = new Date(2004, 0, 1);\nvCard.role = 'Software Development';\n\n//set other phone numbers\nvCard.homePhone = '312-555-1313';\nvCard.cellPhone = '312-555-1414';\nvCard.pagerPhone = '312-555-1515';\n\n//set fax/facsimile numbers\nvCard.homeFax = '312-555-1616';\nvCard.workFax = '312-555-1717';\n\n//set email addresses\nvCard.email = 'e.nesser@emailhost.tld';\nvCard.workEmail = 'e.nesser@acme-corporation.tld';\n\n//set logo of organization or personal logo (also supports embedding, see above)\nvCard.logo.attachFromUrl('https://avatars2.githubusercontent.com/u/5659221?v=3\u0026s=460', 'JPEG');\n\n//set URL where the vCard can be found\nvCard.source = 'http://mywebpage/myvcard.vcf';\n\n//set address information\nvCard.homeAddress.label = 'Home Address';\nvCard.homeAddress.street = '123 Main Street';\nvCard.homeAddress.city = 'Chicago';\nvCard.homeAddress.stateProvince = 'IL';\nvCard.homeAddress.postalCode = '12345';\nvCard.homeAddress.countryRegion = 'United States of America';\n\nvCard.workAddress.label = 'Work Address';\nvCard.workAddress.street = '123 Corporate Loop\\nSuite 500';\nvCard.workAddress.city = 'Los Angeles';\nvCard.workAddress.stateProvince = 'CA';\nvCard.workAddress.postalCode = '54321';\nvCard.workAddress.countryRegion = 'United States of America';\n\n//set social media URLs\nvCard.socialUrls['facebook'] = 'https://...';\nvCard.socialUrls['linkedIn'] = 'https://...';\nvCard.socialUrls['twitter'] = 'https://...';\nvCard.socialUrls['flickr'] = 'https://...';\nvCard.socialUrls['custom'] = 'https://...';\n\n//you can also embed photos from files instead of attaching via URL\nvCard.photo.embedFromFile('photo.jpg');\nvCard.logo.embedFromFile('logo.jpg');\n\nvCard.version = '3.0'; //can also support 2.1 and 4.0, certain versions only support certain fields\n\n//save to file\nvCard.saveToFile('./eric-nesser.vcf');\n\n//get as formatted string\nconsole.log(vCard.getFormattedString());\n```\n\n### Multiple Email, Fax, \u0026 Phone Examples\n\n`email`, `otherEmail`, `cellPhone`, `pagerPhone`, `homePhone`, `workPhone`, `homeFax`, `workFax`, `otherPhone` all support multiple entries in an array format.\n\nExamples are provided below:\n\n```js\nvar vCardsJS = require('vcards-js');\n\n//create a new vCard\nvar vCard = vCardsJS();\n\n//multiple email entry\nvCard.email = [\n    'e.nesser@emailhost.tld',\n    'e.nesser@emailhost2.tld',\n    'e.nesser@emailhost3.tld'\n];\n\n//multiple cellphone\nvCard.cellPhone = [\n    '312-555-1414',\n    '312-555-1415',\n    '312-555-1416'\n];\n\n```\n\n### Apple AddressBook Extensions\n\nYou can mark as a contact as an organization with the following Apple AddressBook extension property:\n\n```js\n    var vCardsJS = require('vcards-js');\n    var vCard = vCardsJS();\n    vCard.isOrganization = true;\n```\n\n## React Native\n\nA React Native version exists here at this repository --\n[https://github.com/idxbroker/vCards-js/tree/react-native](https://github.com/idxbroker/vCards-js/tree/react-native)\n\n## Testing\n\nYou can run the vCard unit tests via `npm`:\n\n```sh\nnpm test\n```\n\n## Contributions\n\nContributions are always welcome!\n\nAdditional thanks to --\n* Tobias Müller ([https://github.com/webdepp](https://github.com/webdepp))\n* Julian Krenge ([https://github.com/jkrenge](https://github.com/jkrenge))\n* Charlie Hulcher ([https://github.com/c-h-](https://github.com/c-h-))\n* Jimmy Tsao ([https://github.com/jimmytsao](https://github.com/jimmytsao))\n* Michael Polino ([https://github.com/mplno](https://github.com/mplno))\n* Randy Stevens ([https://github.com/RandyStevens](https://github.com/RandyStevens))\n\n## Donations\n\nBTC 18N1g2o1b9u2jNPbSpGHhV6x5xs6Qou3EV\n\n## License\nCopyright (c) 2014-2019 Eric J Nesser MIT","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenesser%2FvCards-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fenesser%2FvCards-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fenesser%2FvCards-js/lists"}