Gathering detailed insights and metrics for @flowr-es/ics
Gathering detailed insights and metrics for @flowr-es/ics
Gathering detailed insights and metrics for @flowr-es/ics
Gathering detailed insights and metrics for @flowr-es/ics
npm install @flowr-es/ics
Typescript
Module System
Node Version
NPM Version
70.2
Supply Chain
98
Quality
75.4
Maintenance
100
Vulnerability
99.3
License
JavaScript (99.92%)
Ruby (0.08%)
Total Downloads
917
Last Day
1
Last Week
2
Last Month
5
Last Year
132
500 Commits
6 Branches
1 Contributors
Latest Version
2.33.0
Package Id
@flowr-es/ics@2.33.0
Unpacked Size
49.14 kB
Size
14.04 kB
File Count
25
NPM Version
6.14.15
Node Version
12.22.7
Cumulative downloads
Total Downloads
Last day
0%
1
Compared to previous day
Last week
0%
2
Compared to previous week
Last month
-16.7%
5
Compared to previous month
Last year
-57%
132
Compared to previous year
The iCalendar generator
I decided to make a fork and merge the latest PRs and add some more stuff The original package is here: https://www.npmjs.com/package/ics
Contains: classification, html support - util for DateArray creation and a bugfix with 0 events
npm install -S @flowr-es/ics
1const ics = require('ics') 2 3const event = { 4 start: [2018, 5, 30, 6, 30], 5 duration: { hours: 6, minutes: 30 }, 6 title: 'Bolder Boulder', 7 description: 'Annual 10-kilometer run in Boulder, Colorado', 8 location: 'Folsom Field, University of Colorado (finish line)', 9 url: 'http://www.bolderboulder.com/', 10 geo: { lat: 40.0095, lon: 105.2669 }, 11 categories: ['10k races', 'Memorial Day Weekend', 'Boulder CO'], 12 status: 'CONFIRMED', 13 busyStatus: 'BUSY', 14 organizer: { name: 'Admin', email: 'Race@BolderBOULDER.com' }, 15 attendees: [ 16 { name: 'Adam Gibbons', email: 'adam@example.com', rsvp: true, partstat: 'ACCEPTED', role: 'REQ-PARTICIPANT' }, 17 { name: 'Brittany Seaton', email: 'brittany@example2.org', dir: 'https://linkedin.com/in/brittanyseaton', role: 'OPT-PARTICIPANT' } 18 ] 19} 20 21ics.createEvent(event, (error, value) => { 22 if (error) { 23 console.log(error) 24 return 25 } 26 27 console.log(value) 28 // BEGIN:VCALENDAR 29 // VERSION:2.0 30 // CALSCALE:GREGORIAN 31 // PRODID:adamgibbons/ics 32 // METHOD:PUBLISH 33 // X-PUBLISHED-TTL:PT1H 34 // BEGIN:VEVENT 35 // UID:d9e5e080-d25e-11e8-806a-e73a41d3e47b 36 // SUMMARY:Bolder Boulder 37 // DTSTAMP:20181017T204900Z 38 // DTSTART:20180530T043000Z 39 // DESCRIPTION:Annual 10-kilometer run in Boulder\, Colorado 40 // X-MICROSOFT-CDO-BUSYSTATUS:BUSY 41 // URL:http://www.bolderboulder.com/ 42 // GEO:40.0095;105.2669 43 // LOCATION:Folsom Field, University of Colorado (finish line) 44 // STATUS:CONFIRMED 45 // CATEGORIES:10k races,Memorial Day Weekend,Boulder CO 46 // ORGANIZER;CN=Admin:mailto:Race@BolderBOULDER.com 47 // ATTENDEE;RSVP=TRUE;ROLE=REQ-PARTICIPANT;PARTSTAT=ACCEPTED;CN=Adam Gibbons:mailto:adam@example.com 48 // ATTENDEE;RSVP=FALSE;ROLE=OPT-PARTICIPANT;DIR=https://linkedin.com/in/brittanyseaton;CN=Brittany 49 // Seaton:mailto:brittany@example2.org 50 // DURATION:PT6H30M 51 // END:VEVENT 52 // END:VCALENDAR 53})
1const { writeFileSync } = require('fs') 2const ics = require('ics') 3 4ics.createEvent({ 5 title: 'Dinner', 6 description: 'Nightly thing I do', 7 busyStatus: 'FREE', 8 start: [2018, 1, 15, 6, 30], 9 duration: { minutes: 50 } 10}, (error, value) => { 11 if (error) { 12 console.log(error) 13 } 14 15 writeFileSync(`${__dirname}/event.ics`, value) 16})
1const ics = require('./dist') 2 3const { error, value } = ics.createEvents([ 4 { 5 title: 'Lunch', 6 start: [2018, 1, 15, 12, 15], 7 duration: { minutes: 45 } 8 }, 9 { 10 title: 'Dinner', 11 start: [2018, 1, 15, 12, 15], 12 duration: { hours: 1, minutes: 30 } 13 } 14]) 15 16if (error) { 17 console.log(error) 18 return 19} 20 21console.log(value) 22// BEGIN:VCALENDAR 23// VERSION:2.0 24// CALSCALE:GREGORIAN 25// PRODID:adamgibbons/ics 26// BEGIN:VEVENT 27// UID:3c6d44e8-79a7-428d-acac-9586c9e06e5c 28// SUMMARY:Lunch 29// DTSTAMP:20180210T093900Z 30// DTSTART:20180115T191500Z 31// DURATION:PT45M 32// END:VEVENT 33// BEGIN:VEVENT 34// UID:253cc897-fc26-4f25-9a01-b6bb57fa174d 35// SUMMARY:Dinner 36// DTSTAMP:20180210T093900Z 37// DTSTART:20180115T191500Z 38// DURATION:PT1H30M 39// END:VEVENT 40// END:VCALENDAR
1let ics = require("ics") 2let moment = require("moment") 3let events = [] 4let alarms = [] 5 6let start = moment().format('YYYY-M-D-H-m').split("-") 7let end = moment().add({'hours':2, "minutes":30}).format("YYYY-M-D-H-m").split("-") 8 9alarms.push({ 10 action: 'audio', 11 description: 'Reminder', 12 trigger: {hours:2,minutes:30,before:true}, 13 repeat: 2, 14 attachType:'VALUE=URI', 15 attach: 'Glass' 16}) 17 18let event = { 19 productId:"myCalendarId", 20 uid: "123"+"@ics.com", 21 startOutputType:"local", 22 start: start, 23 end: end, 24 title: "test here", 25 alarms: alarms 26} 27events.push(event) 28console.log(ics.createEvents(events)) 29 30// BEGIN:VCALENDAR 31// VERSION:2.0 32// CALSCALE:GREGORIAN 33// PRODID:MyCalendarId 34// METHOD:PUBLISH 35// X-PUBLISHED-TTL:PT1H 36// BEGIN:VEVENT 37// UID:123@MyCalendarIdics.com 38// SUMMARY:test here 39// DTSTAMP:20180409T072100Z 40// DTSTART:20180409 41// DTEND:20180409 42// BEGIN:VALARM 43// ACTION:DISPLAY 44// DESCRIPTION:Reminder 45// TRIGGER:-PT2H30M 46// END:VALARM 47// BEGIN:VALARM 48// ACTION:AUDIO 49// REPEAT:2 50// ATTACH;VALUE=URI:Glass 51// TRIGGER:PT2H 52// END:VALARM 53// END:VEVENT 54// END:VCALENDAR 55
createEvent(attributes[, callback])
Generates an iCal-compliant VCALENDAR string with one VEVENT.
If a callback is not provided, returns an object having the form { error, value }
,
where value
contains an iCal-compliant string if there are no errors.
If a callback is provided, returns a Node-style callback.
attributes
Object literal containing event information.
Only the start
property is required.
The following properties are accepted:
Property | Description | Example |
---|---|---|
start | Required. Date and time at which the event begins. | [2000, 1, 5, 10, 0] (January 5, 2000) |
startInputType | Type of the date/time data in start :local (default): passed data is in local time.utc : passed data is UTC | |
startOutputType | Format of the start date/time in the output:utc (default): the start date will be sent in UTC format.local : the start date will be sent as "floating" (form #1 in RFC 5545) | |
end | Time at which event ends. Either end or duration is required, but not both. | [2000, 1, 5, 13, 5] (January 5, 2000 at 1pm) |
endInputType | Type of the date/time data in end :local : passed data is in local time.utc : passed data is UTC.The default is the value of startInputType | |
endOutputType | Format of the start date/time in the output:utc : the start date will be sent in UTC format.local : the start date will be sent as "floating" (form #1 in RFC 5545).The default is the value of startOutputType | |
duration | How long the event lasts. Object literal having form { weeks, days, hours, minutes, seconds } Either end or duration is required, but not both. | { hours: 1, minutes: 45 } (1 hour and 45 minutes) |
title | Title of event. | 'Code review' |
description | Description of event. | 'A constructive roasting of those seeking to merge into master branch' |
location | Intended venue | Mountain Sun Pub and Brewery |
geo | Geographic coordinates (lat/lon) | { lat: 38.9072, lon: 77.0369 } |
url | URL associated with event | 'http://www.mountainsunpub.com/' |
status | Three statuses are allowed: TENTATIVE , CONFIRMED , CANCELLED | CONFIRMED |
organizer | Person organizing the event | { name: 'Adam Gibbons', email: 'adam@example.com', dir: 'https://linkedin.com/in/adamgibbons' } |
attendees | Persons invited to the event | [{ name: 'Mo', email: 'mo@foo.com', rsvp: true }, { name: 'Bo', email: 'bo@bar.biz', dir: 'https://twitter.com/bo1234', partstat: 'ACCEPTED', role: 'REQ-PARTICIPANT' }] |
categories | Categories associated with the event | ['hacknight', 'stout month'] |
alarms | Alerts that can be set to trigger before, during, or after the event. The following attach properties work on Mac OS: Basso, Blow, Bottle, Frog, Funk, Glass, Hero, Morse, Ping, Pop, Purr, Sousumi, Submarine, Tink | { action: 'display', description: 'Reminder', trigger: [2000, 1, 4, 18, 30] } OR { action: 'display', description: 'Reminder', trigger: { hours: 2, minutes: 30, before: true } } OR { action: 'display', description: 'Reminder', trigger: { hours: 2, minutes: 30, before: false } OR { action: 'audio', description: 'Reminder', trigger: { hours: 2, minutes: 30, before: true }, repeat: 2, attachType: 'VALUE=URI', attach: 'Glass' } |
productId | Product which created ics, PRODID field | 'adamgibbons/ics' |
uid | Universal unique id for event, produced by default with uuid/v1 . Warning: This value must be globally unique. It is recommended that it follow the RFC 822 addr-spec (i.e. localpart@domain ). Including the @domain half is a good way to ensure uniqueness. | '28021620-be61-11e7-be87-5f3ab42f0785' |
method | This property defines the iCalendar object method associated with the calendar object. When used in a MIME message entity, the value of this property MUST be the same as the Content-Type "method" parameter value. If either the "METHOD" property or the Content-Type "method" parameter is specified, then the other MUST also be specified. | PUBLISH |
recurrenceRule | A recurrence rule, commonly referred to as an RRULE, defines the repeat pattern or rule for to-dos, journal entries and events. If specified, RRULE can be used to compute the recurrence set (the complete set of recurrence instances in a calendar component). You can use a generator like this one | FREQ=DAILY |
sequence | For sending an update for an event (with the same uid), defines the revision sequence number. | 2 |
busyStatus | Used to specify busy status for Microsoft applications, like Outlook. See Microsoft spec. | 'BUSY' OR 'FREE' OR 'TENTATIVE ' OR 'OOF' |
classification | This property defines the access classification for a calendar component. See iCalender spec. | 'PUBLIC' OR 'PRIVATE' OR 'CONFIDENTIAL ' OR any non-standard string |
created | Date-time representing event's creation date. Provide a date-time in UTC | [2000, 1, 5, 10, 0] (January 5, 2000 GMT +00:00) |
lastModified | Date-time representing date when event was last modified. Provide a date-time in UTC | [2000, 1, 5, 10, 0] (January 5, 2000 GMT +00:00) |
calName | Specifies the calendar (not event) name. Used by Apple iCal and Microsoft Outlook; see Open Specification | 'Example Calendar' |
htmlContent | Used to include HTML markup in an event's description. Standard DESCRIPTION tag should contain non-HTML version. | <!DOCTYPE html><html><body><p>This is<br>test<br>html code.</p></body></html> |
To create an all-day event, pass only three values (year
, month
, and date
) to the start
and end
properties.
The date of the end
property should be the day after your all-day event.
For example, in order to create an all-day event occuring on October 15, 2018:
1const eventAttributes = { 2 start: [2018, 10, 15], 3 end: [2018, 10, 16], 4 /* rest of attributes */ 5}
callback
Optional. Node-style callback.
1function (err, value) { 2 if (err) { 3 // if iCal generation fails, err is an object containing the reason 4 // if iCal generation succeeds, err is null 5 } 6 7 console.log(value) // iCal-compliant text string 8}
createEvents(events[, callback])
Generates an iCal-compliant VCALENDAR string with multiple VEVENTS.
If a callback is not provided, returns an object having the form { error, value }
, where value is an iCal-compliant text string
if error
is null
.
If a callback is provided, returns a Node-style callback.
events
Array of attributes
objects (as described in createEvent
).
callback
Optional. Node-style callback.
1function (err, value) { 2 if (err) { 3 // if iCal generation fails, err is an object containing the reason 4 // if iCal generation succeeds, err is null 5 } 6 7 console.log(value) // iCal-compliant text string 8}
Run mocha tests and watch for changes:
npm start
Run tests once and exit:
npm test
Build the project, compiling all ES6 files within the src
directory into vanilla JavaScript in the dist
directory.
npm run build
No vulnerabilities found.
No security vulnerabilities found.