This is a library to parse and read iCalendar files (.ics, .ical). Unlike other solutions, it is fully typed and thus provides a pleasant type hinting experience. It was built along the RFC standard definitions and validates raw input while parsing.
It normalizes values where possible (e.g. possible list values are always accessed as array), but it does not interpret values (like RRULE or timezone references) apart from the value encoding defined in RFC 5545 and RFC 6868.
Install via npm
npm i --save @filecage/ical
⚠️ RFC compliance and validation strictness in development versions are not guaranteed. Anything can change at any time until release 1.x
There are several existing parsers for iCalendar/ICS formats, but none of them met my expectations in neither the interface, the level of provided types nor RFC standard compliance.
Two different functions exist to parse your calendar:
import {parseFile} from '@filecage/ical/parse';
const calendar = await parseFile('my-calendar.ics');
import {parseString} from '@filecage/ical/parse';
const calendar = await parseString(`
BEGIN:VCALENDAR
PRODID:MyCalendar
VERSION:2.0
END:VCALENDAR
`);