npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

vcard-utf8-parser

v1.0.1

Published

Modern TypeScript CommonJS parser for VCF/vCard files with a simple, promise-first API that produces easy-to-read JSON.

Readme

vcard-utf8-parser

CI

Modern TypeScript CommonJS parser for VCF/vCard files with a simple, promise-first API that produces easy-to-read JSON.

Features

  • Promise-first async API
  • Decodes QUOTED-PRINTABLE and BASE64
  • Handles CHARSET with iconv-lite
  • Line unfolding and structured fields (N, ADR, ORG)
  • Keeps all properties in a normalized map

Supported vCard versions

Parses vCard 2.1, 3.0, and 4.0 style property lines. It is lenient and does not validate against the full RFCs.

Install

npm install vcard-utf8-parser

Usage

const { parseFile, parseVcf } = require("vcard-utf8-parser");

async function run() {
  const contacts = await parseFile("contacts.vcf");
  console.log(contacts[0]);
}

run().catch(console.error);

Parse from a string:

const vcfText = "BEGIN:VCARD\nVERSION:2.1\nFN:John Doe\nEND:VCARD";
const contacts = await parseVcf(vcfText);

API

parseFile(path, options)

Reads a VCF file and returns an array of parsed contacts.

Options:

  • fileEncoding: file encoding for the entire VCF (default: utf8)
  • defaultCharset: charset used for encoded values when not specified
  • decodeBase64: return Buffer for base64 values (default: false)
  • includeRaw: include raw vCard lines in card.raw

parseVcf(input, options)

Parses a VCF string (or Buffer) and returns an array of contacts.

Options:

  • inputEncoding: when input is a Buffer, how to decode it (default: utf8)
  • defaultCharset: charset used for encoded values when not specified
  • decodeBase64: return Buffer for base64 values (default: false)
  • includeRaw: include raw vCard lines in card.raw

Output shape

Each card includes normalized fields and all raw properties:

  • formattedName, name, phones, emails, addresses, photos
  • properties: map of property name -> array of detailed entries

This lets you consume a clean JSON shape while still keeping full vCard data.

Field mappings

  • FN -> formattedName
  • N -> name (family, given, additional, prefix, suffix)
  • ORG -> organization (array of components)
  • TITLE -> title
  • TEL -> phones
  • EMAIL -> emails
  • URL -> urls
  • ADR -> addresses
  • NOTE -> notes
  • PHOTO -> photos

JSON example

[
  {
    "version": "4.0",
    "formattedName": "Valid User",
    "name": {
      "family": "User",
      "given": "Valid"
    },
    "organization": ["Example", "Org"],
    "phones": [{ "value": "+123456", "types": ["cell"], "pref": true }],
    "emails": [{ "value": "[email protected]", "types": ["work"], "pref": false }],
    "addresses": [
      {
        "street": "Street",
        "locality": "City",
        "region": "Region",
        "postalCode": "12345",
        "country": "Country",
        "types": ["work"],
        "pref": false
      }
    ],
    "photos": [],
    "properties": {
      "FN": [{ "name": "FN", "params": {}, "value": "Valid User", "rawValue": "Valid User" }]
    }
  }
]

Limitations

  • Lenient parser; it does not validate full vCard conformance.
  • Unknown properties are preserved under properties but are not normalized.
  • Base64 values are returned as strings unless decodeBase64 is enabled.