init
This commit is contained in:
36
result.md
Normal file
36
result.md
Normal 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.
|
||||
Reference in New Issue
Block a user