Giter Club home page Giter Club logo

ics's Introduction

ICS File Generator

Generate iCalendar files.

npm version Code Climate TravisCI build status

Installation

npm install ics

Usage

Require the module: require('ics').

ics.getEvent(options)

Returns an iCal-compliant text string.

ics.createEvent(options, filepath, cb)

Returns a callback with an iCal-compliant .ics file.

Options:

  • dtstart: (Date string) Event start time. Defaults to current time.
  • dtend: (Date string) Event end time. Defaults to one hour from dtstart.
  • description: (String) Description (details) of the event.
  • eventName: (String) Title of the event as it appears in calendar application
  • filename: (String) Name of the iCal file. Defaults to calendar-event.ics.
  • location: (String) Location of the event.
  • organizer: (Object)
    • name: (String)
    • email: (String)
  • attendees: (Object)
    • name: (String)
    • email: (String)
    • rsvp: (boolean) Default True

Example:

var ical = require('ics');

var options = {
  eventName: 'Fingerpainting lessons',
  filename: 'event.ics',
  dtstart: 'Sat Nov 02 2014 13:15:00 GMT-0700 (PDT)',
  location: 'Here and there',
  email: {
    name: 'Isaac Asimov',
    email: '[email protected]'
  }
};

ical.createEvent(options, null, function(err, success) {
  if (err) {
    console.log(err);
  }

  console.log(success); // returns filepath
});

The above snippet creates a file named event.ics, saves it to the operating system's temporary directory, and returns the filepath.

The event.ics file should look something like this:

BEGIN:VCALENDAR
VERSION:2.0
BEGIN:VEVENT
DTSTAMP:20150701T170000Z
ORGANIZER;CN=John Doe:MAILTO:[email protected]
DTSTART:20150714T170000Z
DTEND:20150715T035959Z
SUMMARY:Fingerpainting lessons
END:VEVENT
END:VCALENDAR

TODO

References

RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar)

Initial iCalendar Elements Registries

EXAMPLE

Check out our expressjs example.Follow the instructions below to try it out npm install cd ex node app.js

Then go over to the browser and hit this url http://localhost:3000/create

A file will be created and your can reach it in the browser here localhost:3000/created/example.ics

ics's People

Contributors

adamgibbons avatar duvel avatar jasonhumphrey2 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.