# ics-service

> Create a calendar feed people can subscribe to.

Latest version **1.4.0** (published 2023-05-24) · ISC license · 0 weekly downloads

## Install

```sh
npm install ics-service
pnpm add ics-service
yarn add ics-service
bun add ics-service
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.4.0 |
| Published | 2023-05-24 |
| First published | 2020-04-08 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=10 |
| Dependencies | 3 |
| Unpacked size | 10.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 34 |
| Author | Jannis R |
| Maintainers | derhuerst |
| Keywords | ics, calendar, ical, subscription |

## Links

- npm: https://www.npmjs.com/package/ics-service
- Repository: https://github.com/derhuerst/ics-service
- Issues: https://github.com/derhuerst/ics-service/issues
- npm.io page: https://npm.io/package/ics-service

## Dependencies (3)

- [ics](https://npm.io/package/ics.md) ^3.1.0
- [etag](https://npm.io/package/etag.md) ^1.8.1
- [escape-goat](https://npm.io/package/escape-goat.md) ^3.0.0

## Recent versions

- 1.4.0 (latest) — 2023-05-24
- 1.3.0 — 2023-05-01
- 1.2.3 — 2022-12-18
- 1.2.2 — 2022-07-29
- 1.2.1 — 2021-05-10
- 1.2.0 — 2020-09-09
- 1.1.1 — 2020-09-09
- 1.1.0 — 2020-04-08
- 1.0.0 — 2020-04-08

## README

# ics-service

**Create a calendar feed people can subscribe to.**

[![npm version](https://img.shields.io/npm/v/ics-service.svg)](https://www.npmjs.com/package/ics-service)
![ISC-licensed](https://img.shields.io/github/license/derhuerst/ics-service.svg)
![minimum Node.js version](https://img.shields.io/node/v/ics-service.svg)
[![support me via GitHub Sponsors](https://img.shields.io/badge/support%20me-donate-fa7664.svg)](https://github.com/sponsors/derhuerst)
[![chat with me on Twitter](https://img.shields.io/badge/chat%20with%20me-on%20Twitter-1da1f2.svg)](https://twitter.com/derhuerst)


## Installation

```shell
npm install ics-service
```


## Usage

```js
const express = require('express')
const generateIcs = require('ics-service/generate-ics')
const aboutRoute = require('ics-service/about')
const feedRoute = require('ics-service/feed')

const TITLE = 'some calendar feed'
const GENERATOR = 'my feed generator'

const events = [{
	uid: 'a', title: 'A', description: 'A.',
	location: 'Alamo Square, San Francisco, CA',
	url: 'https://example.org/',
	geo: {lat: 37.774703, lon: -122.432642, radius: 20},
	categories: ['event'],
	start: [2020, 8, 8, 8, 8],
	duration: {hours: 1, minutes: 30},
	status: 'CONFIRMED',
	sequence: 1,
	productId: GENERATOR,
}, {
	uid: 'b',
	title: 'B', description: 'B.',
	start: [2020, 9, 9, 9, 9],
	duration: {hours: 0, minutes: 45},
	status: 'CONFIRMED',
	sequence: 2,
	productId: GENERATOR,
}]

const getIcs = feedUrl => generateIcs(TITLE, events, feedUrl)

const app = express()
app.use('/feed', feedRoute(getIcs))
app.use('/', aboutRoute(TITLE))
```

The `events` array is passed into [`ics@3`](https://github.com/adamgibbons/ics/tree/v3.0.0) almost unaltered, so check [`ics`'s docs](https://github.com/adamgibbons/ics/blob/v3.0.0/README.md) for more information on the format.

Optionally, you can pass an options object into `generateIcs`, whose fields selectively override the following defaults:

```js
{
	// Send a Cache-Control header to let clients and/or shared caches (a.k.a. CDNS)
	// cache the calendar feed. If you set this option to false, it won't be sent.
	// see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Cache-Control
	cacheControl: true,
	// The number of seconds that a the calendar-feed is allowed to be cached.
	// Note: With ics-service's next major version dump, this will be increased.
	maxAge: 0,
	// Send an ETag header, so that clients don't have to redownload the calendar feed.
	// see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/ETag
	etag: true,
}
```


## Contributing

If you have a question or need support using `ics-service`, please double-check your code and setup first. If you think you have found a bug or want to propose a feature, use [the issues page](https://github.com/derhuerst/ics-service/issues).

---
_Source: https://npm.io/package/ics-service · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
