A Node.js native addon that provides access to macOS [EventKit](https://developer.apple.com/documentation/eventkit) functionality, allowing you to work with calendars and reminders.
npm install eventkit-nodeA Node.js native addon that provides access to macOS EventKit functionality, allowing you to work with calendars and reminders.
This library is a bridge between Node.js and Apple's EventKit framework, providing a JavaScript-friendly API for managing calendars, events, and reminders on macOS.
- macOS 10.15 or later
- Node.js 14 or later
- Xcode 12 or later with Command Line Tools installed
``bash`
npm install eventkit-node
`javascript
const { requestFullAccessToEvents, getCalendars } = require('eventkit-node');
async function main() {
// Request access to calendars
const granted = await requestFullAccessToEvents();
if (granted) {
// Get all event calendars
const calendars = getCalendars('event');
console.log('Available calendars:', calendars.map(c => c.title));
} else {
console.log('Calendar access was denied');
}
}
main();
`
For more detailed examples, please see the Examples documentation.
When using this library in your application, you must include the following privacy descriptions in your application's Info.plist:
`xml
`
Without these descriptions, permission requests will silently fail.
The addon provides a clean, JavaScript-friendly API for working with calendars and reminders.
- requestFullAccessToEvents() - Request full access to the user's calendarsrequestFullAccessToReminders()
- - Request full access to the user's remindersrequestWriteOnlyAccessToEvents()
- - Request write-only access to the user's calendarsgetCalendars(entityType)
- - Get calendars for a specific entity type (event or reminder)getCalendar(identifier)
- - Get a calendar by its identifiersaveCalendar(calendarData, commit)
- - Create or update a calendar, with optional commit parameterremoveCalendar(identifier, commit)
- - Remove a calendar by its identifiergetDefaultCalendarForNewEvents()
- - Get the default calendar for new eventsgetDefaultCalendarForNewReminders()
- - Get the default calendar for new reminders
- saveEvent(eventData, span, commit) - Create or update an event, with optional span and commit parameterssaveReminder(reminderData, commit)
- - Create or update a reminder, with optional commit parameterremoveEvent(identifier, span, commit)
- - Remove an event by its identifier, with optional span and commit parametersremoveReminder(identifier, commit)
- - Remove a reminder by its identifier, with optional commit parameter
- commit() - Commit all pending changes to the event storereset()
- - Reset the event store by discarding all unsaved changesrefreshSourcesIfNecessary()
- - Refresh the sources in the event store if necessary
- getSources() - Get all available calendar sourcesgetDelegateSources()
- - Get all delegate sources (macOS 12.0+)getSource(sourceId)
- - Get a specific source by ID
- createEventPredicate(startDate, endDate, calendarIds?) - Create a predicate for querying eventscreateReminderPredicate(calendarIds?)
- - Create a predicate for querying all reminderscreateIncompleteReminderPredicate(startDate?, endDate?, calendarIds?)
- - Create a predicate for querying incomplete reminderscreateCompletedReminderPredicate(startDate?, endDate?, calendarIds?)
- - Create a predicate for querying completed remindersgetEventsWithPredicate(predicate)
- - Get events matching a predicategetRemindersWithPredicate(predicate)
- - Get reminders matching a predicate (returns a Promise)getEvent(identifier)
- - Get an event by its unique identifiergetCalendarItem(identifier)
- - Get a calendar item (event or reminder) by its identifiergetCalendarItemsWithExternalIdentifier(externalIdentifier)
- - Get calendar items with a specific external identifier
For more detailed information, please refer to the following documentation:
- API Reference - Detailed information about all functions and types
- Examples - Practical usage examples
- Troubleshooting Guide - Solutions for common issues
This library is based on Apple's EventKit framework. For more information about the underlying APIs and concepts, please refer to:
- EventKit Framework Documentation
- Calendar and Reminders Programming Guide
`bashInstall dependencies
npm install