1.0.5 • Published 2 years ago

generate-ical v1.0.5

Weekly downloads
-
License
-
Repository
github
Last release
2 years ago

generate-ical

This is a lightweight and typed utility to generate iCal files. With minimal dependencies and minimal code and complexity, this can be used almost everywhere.

It doesn't depend on the implementation, e.g Express, Koa, file system, etc. This will just generate the file content as a string for you to do whatever you want with.

Install

npm install generate-ical

Usage

const fileContent = generateIcal({
	title: "My First Event",
	description: {
		plain: "My event description",
		html: "<p>My event description <b>formatted with HTML</b></p>",
	},
	isAllDay: false,
	startDate: new Date("2023-01-01T18:00:00.000Z"),
	endDate: new Date("2023-01-01T22:00:00.000Z"),
	location: { title: "My place" },
	url: "https://optional-video-call.com",
	organizer: { name: "Lukas Wiklund" },
})

Examples

File System

fs.writeFileSync("./Event.ics", fileContent)

Koa

context.response.set("Content-Type", "text/calendar")
context.response.set("Content-Disposition", `attachment; filename="Event.ics"`)
context.body = fileContent
1.0.5

2 years ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago