Skip to content

Server-side NodeJS / TypeScript package #1

@Maxim-Mazurok

Description

@Maxim-Mazurok

In case if anyone comes here looking for NodeJS / TypeScript package,

I've used ez-vcard written in Java and created a NodeJS / TS wrapper, so now you can use it from the server-side JavaScript.

npm; GitHub

npm i ez-vcard
import path from 'path';
import ezVcard, {Config, VcardData} from '../src/index';

(async () => {
  const data: VcardData = {
    name: {
      first: 'Maxim',
      last: 'Mazurok',
      full: 'Maxim Mazurok',
    },
    job: {
      title: 'Software Engineer',
      org: 'WiseTech Global',
    },
    online: {
      links: [
        'https://maxim.mazurok.com',
        'https://www.linkedin.com/in/maximmazurok',
      ],
      email: 'maxim@mazurok.com',
    },
    geo: {
      timezone: 'Australia/NSW',
      coordinates: {
        lat: -33.9242491,
        lon: 151.1918779,
      },
      addresses: [
        {
          street: '28 Ebsworth Street',
          city: 'Sydney',
          region: 'NSW',
          postCode: '2017',
          country: 'Australia',
          types: ['HOME'],
        },
      ],
    },
    phoneNumbers: [
      {
        number: '+61402282326',
        type: 'CELL',
      },
      {
        number: '+380984877707',
        type: 'CELL',
      },
    ],
    misc: {
      note: 'Professional web developer',
      birthday: {
        year: 1997,
        month: 'FEBRUARY',
        day: 14,
      },
      uid: '9aff8498-14c4-43ab-9ac6-40c2953c33ff',
      photo: {
        path: path.join(__dirname, 'contact_picture.jpg'),
        type: 'JPEG',
      },
      vcardUrl: 'https://maxim.mazurok.com/vcard.vcf',
      setRevision: true,
    },
  };

  const config: Config = {
    version: 'V2_1', // "V2_1" | "V3_0" | "V4_0"
    prodId: false, // remove `X-PRODID:ez-vcard 0.10.6`
  };

  const vcard = await ezVcard(data, config);

  console.log(vcard);
})();

Also, see readme and example

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions