iamcal
v1.0.1
Published
Read and write ICalendar files
Downloads
133
Readme
iamcal
A library for reading, modifying and writing ICalendar files.
Installation
iamcal can be installed from the npm registry:
npm install iamcal
Getting started/Example
This code;
import { Calendar } from 'iamcal'
import { dump } from 'iamcal/io'
import { parseCalendar } from 'iamcal/parse'
const calendar: Calendar = await parseCalendar(`
BEGIN:VCALENDAR
VERSION:2.0
PRODID:example
BEGIN:VEVENT
SUMMARY:🎉iamcal release party
LOCATION:Las Vegas!!
UID:[email protected]
DTSTAMP:20241209T100000Z
DTSTART:20241211T200000Z
DTEND:20241211T230000Z
END:VEVENT
END:VCALENDAR
`)
calendar.events().forEach(event => {
if (event.summary() === "🎉iamcal release party") {
event.setLocation("My house (budget cuts sorry)")
}
})
await dump(calendar, "./new_calendar.ics")
produces the file new_calendar.ics
:
BEGIN:VCALENDAR
VERSION:2.0
PRODID:example
BEGIN:VEVENT
SUMMARY:🎉iamcal release party
LOCATION:My house (budget cuts sorry)
UID:[email protected]
DTSTAMP:20241209T100000Z
DTSTART:20241211T200000Z
DTEND:20241211T230000Z
END:VEVENT
END:VCALENDAR