This commit is contained in:
Luk
2026-03-16 14:55:27 +08:00
commit 7a191d4e2a
21 changed files with 1027 additions and 0 deletions

36
result.md Normal file
View File

@@ -0,0 +1,36 @@
```js
// create-event.js
// npm install ics
const { createEvent } = require(\"ics\");
const fs = require(\"fs\");
const event = {
title: \"Birthday Party\",
start: [2024, 7, 20], // YYYY, M, D
duration: { hours: 2 },
attendees: [
{ name: \"Alice\" },
{ name: \"Bob\" }
]
};
createEvent(event, (error, value) => {
if (error) {
console.error(\"Error creating event:\", error);
return;
}
fs.writeFileSync(\"birthday-party.ics\", value);
console.log(\"Calendar event created: birthday-party.ics\");
});
```
Run it with:
```bash
npm install ics
node create-event.js
```
This will generate a `birthday-party.ics` file you can import into a calendar app.