Generate iCalendar files.
npm install ics
Require the module: require('ics')
.
Returns an iCal-compliant text string.
Returns a callback with an iCal-compliant .ics
file.
dtstart
: (Date string) Event start time. Defaults to current time.dtend
: (Date string) Event end time. Defaults to one hour fromdtstart
.description
: (String) Description (details) of the event.eventName
: (String) Title of the event as it appears in calendar applicationfilename
: (String) Name of the iCal file. Defaults tocalendar-event.ics
.location
: (String) Location of the event.organizer
: (Object)name
: (String)email
: (String)
attendees
: (Object)name
: (String)email
: (String)rsvp
: (Boolean) Defaults tofalse
.
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
- Description property
- Add express/restify browser download examples
- Add Attendees
- Recurrence Identifier Range
- Alarm Trigger Relationship
- Time Zone Identifier
- Geographic Position
- Location
RFC 5545: Internet Calendaring and Scheduling Core Object Specification (iCalendar)
Initial iCalendar Elements Registries
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