Gathering detailed insights and metrics for @denzorn/ical-toolkit
Gathering detailed insights and metrics for @denzorn/ical-toolkit
Gathering detailed insights and metrics for @denzorn/ical-toolkit
Gathering detailed insights and metrics for @denzorn/ical-toolkit
ICal generator/updater/parser with Timezone/DST, Alams, Organizers, Events, etc. support.
npm install @denzorn/ical-toolkit
Typescript
Module System
Node Version
NPM Version
JavaScript (100%)
Total Downloads
1,090
Last Day
8
Last Week
13
Last Month
82
Last Year
892
NOASSERTION License
21 Commits
1 Branches
1 Contributors
Updated on Apr 04, 2024
Minified
Minified + Gzipped
Latest Version
1.0.12
Package Id
@denzorn/ical-toolkit@1.0.12
Unpacked Size
378.36 kB
Size
50.63 kB
File Count
870
NPM Version
8.5.5
Node Version
16.15.0
Published on
Apr 04, 2024
Cumulative downloads
Total Downloads
Last Day
166.7%
8
Compared to previous day
Last Week
-7.1%
13
Compared to previous week
Last Month
-43.1%
82
Compared to previous month
Last Year
350.5%
892
Compared to previous year
1
2
#ICal Toolkit NodeJS ICal generator/updater/parser with Timezone/DST, Alams, Organizers, Events, etc. support.
100% JavaScript implementation.
Ical generator supports the following:
VTIMEZONE - TIMEZONE/DST info. We have inbuilt timezone database, you just specify TimeZone ID and rest module will take care.
Alarms
Attendees info and state per event.
Organizers
Multiple events
Full day and repeating events
URL property
Simple intuitive interface.
##Install
1> npm install @denzorn/ical-toolkit
##Builder Quick documentation, but covers all and will get you going quick!
####Values to use: Here are the constants you can use:
#####Attendee Role
"REQ-PARTICIPANT"; Indicates a participant whose
; participation is required
"OPT-PARTICIPANT" ; Indicates a participant whose
; participation is optional
"NON-PARTICIPANT" ; Indicates a participant who is
; copied for information purposes only
#####Attendee Status
"NEEDS-ACTION" ; Event needs action
"ACCEPTED" ; Event accepted
"DECLINED" ; Event declined
"TENTATIVE" ; Event tentatively accepted
"DELEGATED" ; Event delegated
#####Methods
'PUBLISH',
'REQUEST',
'REPLY',
'ADD',
'CANCEL',
'REFRESH',
'COUNTER',
'DECLINECOUNTER'
#####Repeating Freq for event
'SECONDLY',
'MINUTELY',
'HOURLY',
'DAILY',
'WEEKLY',
'MONTHLY',
'YEARLY'
#####Statuses for event
'CONFIRMED',
'TENTATIVE',
'CANCELLED'
###Demo code, shows all.
1var icalToolkit = require('ical-toolkit'); 2 3//Create a builder 4var builder = icalToolkit.createIcsFileBuilder(); 5 6/* 7 * Settings (All Default values shown below. It is optional to specify) 8 * */ 9builder.spacers = true; //Add space in ICS file, better human reading. Default: true 10builder.NEWLINE_CHAR = '\r\n'; //Newline char to use. 11builder.throwError = false; //If true throws errors, else returns error when you do .toString() to generate the file contents. 12builder.ignoreTZIDMismatch = true; //If TZID is invalid, ignore or not to ignore! 13 14 15/** 16 * Build ICS 17 * */ 18 19//Name of calander 'X-WR-CALNAME' tag. 20builder.calname = 'Yo Cal'; 21 22//Cal timezone 'X-WR-TIMEZONE' tag. Optional. We recommend it to be same as tzid. 23builder.timezone = 'america/new_york'; 24 25//Time Zone ID. This will automatically add VTIMEZONE info. 26builder.tzid = 'america/new_york'; 27 28//Method 29builder.method = 'REQUEST'; 30 31//Add events 32builder.events.push({ 33 34 //Event start time, Required: type Date() 35 start: new Date(), 36 37 //Event end time, Required: type Date() 38 end: new Date(), 39 40 //transp. Will add TRANSP:OPAQUE to block calendar. 41 transp: 'OPAQUE', 42 43 //Event summary, Required: type String 44 summary: 'Test Event', 45 46 //All Optionals Below 47 48 //Alarms, array in minutes 49 alarms: [15, 10, 5], 50 51 //Optional: If you need to add some of your own tags 52 additionalTags: { 53 'SOMETAG': 'SOME VALUE' 54 }, 55 56 //Event identifier, Optional, default auto generated 57 uid: null, 58 59 //Optional, The sequence number in update, Default: 0 60 sequence: null, 61 62 //Optional if repeating event 63 repeating: { 64 freq: 'DAILY', 65 count: 10, 66 interval: 10, 67 until: new Date(), 68 byday: 'mo,tu,we,th,fr' 69 }, 70 71 //Optional if all day event 72 allDay: true, 73 74 //Creation timestamp, Optional. 75 stamp: new Date(), 76 77 //Optional, floating time. 78 floating: false, 79 80 //Location of event, optional. 81 location: 'Home', 82 83 //Optional description of event. 84 description: 'Testing it!', 85 86 //Optional Organizer info 87 organizer: { 88 name: 'Kushal Likhi', 89 email: 'test@mail', 90 sentBy: 'person_acting_on_behalf_of_organizer@email.com' //OPTIONAL email address of the person who is acting on behalf of organizer. 91 }, 92 93 //Optional attendees info 94 attendees: [ 95 { 96 name: 'A1', //Required 97 email: 'a1@email.com', //Required 98 status: 'TENTATIVE', //Optional 99 role: 'REQ-PARTICIPANT', //Optional 100 rsvp: true //Optional, adds 'RSVP=TRUE' , tells the application that organiser needs a RSVP response. 101 }, 102 { 103 name: 'A2', 104 email: 'a2@email.com' 105 } 106 ] 107 108 //What to do on addition 109 method: 'PUBLISH', 110 111 //Status of event 112 status: 'CONFIRMED', 113 114 //Url for event on core application, Optional. 115 url: 'http://google.com' 116}); 117 118//Optional tags on VCALENDAR level if you intent to add. Optional field 119builder.additionalTags = { 120 'SOMETAG': 'SOME VALUE' 121}; 122 123 124//Try to build 125var icsFileContent = builder.toString(); 126 127//Check if there was an error (Only required if yu configured to return error, else error will be thrown.) 128if (icsFileContent instanceof Error) { 129 console.log('Returned Error, you can also configure to throw errors!'); 130 //handle error 131} 132 133//Here isteh ics file content. 134console.log(icsFileContent); 135
####Output####
BEGIN:VCALENDAR
VERSION:2.0
CALSCALE:GREGORIAN
X-WR-CALNAME:Yo Cal
METHOD:REQUEST
PRODID:node-ical-toolkit
X-WR-TIMEZONE:asia/kalcutta
BEGIN:VTIMEZONE
TZID:America/New_York
X-LIC-LOCATION:America/New_York
BEGIN:DAYLIGHT
TZOFFSETFROM:-0500
TZOFFSETTO:-0400
TZNAME:EDT
DTSTART:19700308T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=2SU
END:DAYLIGHT
BEGIN:STANDARD
TZOFFSETFROM:-0400
TZOFFSETTO:-0500
TZNAME:EST
DTSTART:19701101T020000
RRULE:FREQ=YEARLY;BYMONTH=11;BYDAY=1SU
END:STANDARD
END:VTIMEZONE
BEGIN:VEVENT
UID:f0e532a3
DTSTAMP:20150707T070727Z
TRANSP:OPAQUE
DTSTART;VALUE=DATE:20150707
DTEND;VALUE=DATE:20150707
SUMMARY:Test Event
SEQUENCE:0
LOCATION:Home
DESCRIPTION:Testing it!
URL;VALUE=URI:http://google.com
STATUS:CONFIRMED
ORGANIZER;SENT-BY="MAILTO:hello@test.com":CN="Kushal Likhi":mailto:test@mail
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=TENTATIVE;RSVP=TRUE;CN=A1:MAILTO:a1@email.com
ATTENDEE;ROLE=REQ-PARTICIPANT;PARTSTAT=NEEDS-ACTION;CN=A2:MAILTO:a2@email.com
BEGIN:VALARM
TRIGGER:-PT15M
ACTION:DISPLAY
END:VALARM
BEGIN:VALARM
TRIGGER:-PT10M
ACTION:DISPLAY
END:VALARM
BEGIN:VALARM
TRIGGER:-PT5M
ACTION:DISPLAY
END:VALARM
RRULE:FREQ=DAILY;COUNT=10;INTERVAL=10;UNTIL=20150707T070727Z
SOMETAG:SOME VALUE
END:VEVENT
SOMETAG:SOME VALUE
END:VCALENDAR
##Parser## Parse the ics files to JSON structures
1 it('should parse the content sync', function (done) { 2 var json = icalToolkit.parseToJSON(icsContent); 3 assert(json); 4 assert(!(json instanceof Error)); 5 assert(json.VCALENDAR); 6 done(); 7 }); 8 9 it('should parse the content async', function (done) { 10 icalToolkit.parseToJSON(icsContent, function (err, json) { 11 if (err) throw err; 12 assert(json); 13 assert(!(json instanceof Error)); 14 assert(json.VCALENDAR); 15 done(); 16 }); 17 }); 18 19 it('should parse the file', function (done) { 20 icalToolkit.parseFileToJSON(sampleFilePAth, function (err, json) { 21 if (err) throw err; 22 assert(json); 23 assert(!(json instanceof Error)); 24 assert(json.VCALENDAR); 25 done(); 26 }); 27 }); 28 29 it('should parse the file sync', function (done) { 30 var json = icalToolkit.parseFileToJSONSync(sampleFilePAth); 31 assert(json); 32 assert(!(json instanceof Error)); 33 assert(json.VCALENDAR); 34 done(); 35 }); 36
No vulnerabilities found.
No security vulnerabilities found.